xref: /llvm-project/llvm/test/Transforms/Attributor/IPConstantProp/recursion.ll (revision 23dafbb1e5deb76f1ee6a1325e517bb45be1fb04)
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; CHECK-NOT: %X
6
7define internal i32 @foo(i32 %X) {
8; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
9; CGSCC-LABEL: define {{[^@]+}}@foo
10; CGSCC-SAME: () #[[ATTR0:[0-9]+]] {
11; CGSCC-NEXT:    ret i32 undef
12;
13  %Y = call i32 @foo( i32 %X )            ; <i32> [#uses=1]
14  %Z = add i32 %Y, 1              ; <i32> [#uses=1]
15  ret i32 %Z
16}
17
18define void @bar() {
19; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
20; TUNIT-LABEL: define {{[^@]+}}@bar
21; TUNIT-SAME: () #[[ATTR0:[0-9]+]] {
22; TUNIT-NEXT:    ret void
23;
24; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
25; CGSCC-LABEL: define {{[^@]+}}@bar
26; CGSCC-SAME: () #[[ATTR0]] {
27; CGSCC-NEXT:    ret void
28;
29  call i32 @foo( i32 17 )         ; <i32>:1 [#uses=0]
30  ret void
31}
32
33;.
34; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
35;.
36; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn memory(none) }
37;.
38;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
39; CHECK: {{.*}}
40