xref: /llvm-project/llvm/test/Transforms/Attributor/IPConstantProp/2008-06-09-WeakProp.ll (revision 7d16a35c83d239a8fba44bdff9ffadcc32bb524b)
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; Should not propagate the result of a weak function.
6; PR2411
7
8define weak i32 @foo() nounwind  {
9; CHECK: Function Attrs: nounwind
10; CHECK-LABEL: define {{[^@]+}}@foo
11; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
12; CHECK-NEXT:  entry:
13; CHECK-NEXT:    ret i32 1
14;
15entry:
16  ret i32 1
17}
18
19define i32 @main() nounwind  {
20; CHECK: Function Attrs: nounwind
21; CHECK-LABEL: define {{[^@]+}}@main
22; CHECK-SAME: () #[[ATTR0]] {
23; CHECK-NEXT:  entry:
24; CHECK-NEXT:    [[R:%.*]] = call i32 @foo() #[[ATTR0]]
25; CHECK-NEXT:    ret i32 [[R]]
26;
27entry:
28  %r = call i32 @foo( ) nounwind
29  ret i32 %r
30}
31
32;.
33; CHECK: attributes #[[ATTR0]] = { nounwind }
34;.
35;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
36; CGSCC: {{.*}}
37; TUNIT: {{.*}}
38