xref: /llvm-project/llvm/test/Transforms/Attributor/IPConstantProp/global.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@_ZL6test1g = internal global i32 42, align 4
6
7;.
8; CHECK: @_ZL6test1g = internal global i32 42, align 4
9;.
10define void @_Z7test1f1v() nounwind {
11; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
12; CHECK-LABEL: define {{[^@]+}}@_Z7test1f1v
13; CHECK-SAME: () #[[ATTR0:[0-9]+]] {
14; CHECK-NEXT:  entry:
15; CHECK-NEXT:    br label [[IF_END:%.*]]
16; CHECK:       if.then:
17; CHECK-NEXT:    unreachable
18; CHECK:       if.end:
19; CHECK-NEXT:    ret void
20;
21entry:
22  %tmp = load i32, ptr @_ZL6test1g, align 4
23  %cmp = icmp eq i32 %tmp, 0
24  br i1 %cmp, label %if.then, label %if.end
25
26if.then:                                          ; preds = %entry
27  store i32 0, ptr @_ZL6test1g, align 4
28  br label %if.end
29
30if.end:                                           ; preds = %if.then, %entry
31  ret void
32}
33
34define i32 @_Z7test1f2v() nounwind {
35; CHECK: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
36; CHECK-LABEL: define {{[^@]+}}@_Z7test1f2v
37; CHECK-SAME: () #[[ATTR0]] {
38; CHECK-NEXT:  entry:
39; CHECK-NEXT:    ret i32 42
40;
41entry:
42  %tmp = load i32, ptr @_ZL6test1g, align 4
43  ret i32 %tmp
44}
45;.
46; CHECK: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) }
47;.
48;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
49; CGSCC: {{.*}}
50; TUNIT: {{.*}}
51