xref: /llvm-project/llvm/test/Transforms/Attributor/ArgumentPromotion/naked_functions.ll (revision cd3a4c31bc9694d160de54c6a4daa53e152cb463)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal  -attributor-annotate-decl-cs  -S < %s | FileCheck %s --check-prefixes=CHECK,TUNIT
3; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal  -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,CGSCC
4
5; Don't promote paramaters of/arguments to naked functions
6
7@g = common global i32 0, align 4
8
9;.
10; CHECK: @g = common global i32 0, align 4
11;.
12define i32 @bar() {
13; CHECK-LABEL: define {{[^@]+}}@bar() {
14; CHECK-NEXT:  entry:
15; CHECK-NEXT:    [[CALL:%.*]] = call i32 @foo(ptr noundef nonnull align 4 dereferenceable(4) @g)
16; CHECK-NEXT:    ret i32 [[CALL]]
17;
18entry:
19  %call = call i32 @foo(ptr @g)
20  ret i32 %call
21}
22
23define internal i32 @foo(ptr) #0 {
24; CHECK: Function Attrs: naked
25; CHECK-LABEL: define {{[^@]+}}@foo
26; CHECK-SAME: (ptr [[TMP0:%.*]]) #[[ATTR0:[0-9]+]] {
27; CHECK-NEXT:  entry:
28; CHECK-NEXT:    [[RETVAL:%.*]] = alloca i32, align 4
29; CHECK-NEXT:    call void asm sideeffect "ldr r0, [r0] \0Abx lr \0A", ""()
30; CHECK-NEXT:    unreachable
31;
32entry:
33  %retval = alloca i32, align 4
34  call void asm sideeffect "ldr r0, [r0] \0Abx lr        \0A", ""()
35  unreachable
36}
37
38
39attributes #0 = { naked }
40;.
41; CHECK: attributes #[[ATTR0]] = { naked }
42;.
43;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
44; CGSCC: {{.*}}
45; TUNIT: {{.*}}
46