xref: /llvm-project/llvm/test/Transforms/LowerIFunc/ifunc-nonsense-resolvers.ll (revision e7cd42f8e4da1beed52f401dcf87d22d36a2c81c)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --include-generated-funcs
2; RUN: opt -S -passes=lower-ifunc < %s | FileCheck %s
3
4@ifunc_with_arg = ifunc void (), ptr @resolver_with_arg
5
6; Test a resolver with an argument (which probably should not be legal
7; IR).
8define ptr @resolver_with_arg(i64 %arg) {
9  %cast = inttoptr i64 %arg to ptr
10  ret ptr %cast
11}
12
13define void @call_with_arg() {
14  call void @ifunc_with_arg()
15  ret void
16}
17;.
18; CHECK: @[[GLOB0:[0-9]+]] = internal global [1 x ptr] poison, align 8
19; CHECK: @[[LLVM_GLOBAL_CTORS:[a-zA-Z0-9_$"\\.-]+]] = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 10, ptr @[[GLOB1:[0-9]+]], ptr null }]
20; CHECK: @[[IFUNC_WITH_ARG:[a-zA-Z0-9_$"\\.-]+]] = ifunc void (), ptr @resolver_with_arg
21;.
22; CHECK-LABEL: define {{[^@]+}}@resolver_with_arg(
23; CHECK-NEXT:    [[CAST:%.*]] = inttoptr i64 [[ARG:%.*]] to ptr
24; CHECK-NEXT:    ret ptr [[CAST]]
25;
26;
27; CHECK-LABEL: define {{[^@]+}}@call_with_arg(
28; CHECK-NEXT:    call void @ifunc_with_arg()
29; CHECK-NEXT:    ret void
30;
31;
32; CHECK-LABEL: define {{[^@]+}}@1(
33; CHECK-NEXT:    ret void
34;
35