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
6 @b = common local_unnamed_addr global i32 0, align 4
7 @a = common local_unnamed_addr global i32 0, align 4
10 ; CHECK: @b = common local_unnamed_addr global i32 0, align 4
11 ; CHECK: @a = common local_unnamed_addr global i32 0, align 4
13 define i32 @fn2() local_unnamed_addr {
14 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
15 ; TUNIT-LABEL: define {{[^@]+}}@fn2
16 ; TUNIT-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {
17 ; TUNIT-NEXT: [[TMP1:%.*]] = load i32, ptr @b, align 4
18 ; TUNIT-NEXT: [[TMP2:%.*]] = sext i32 [[TMP1]] to i64
19 ; TUNIT-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to ptr
20 ; TUNIT-NEXT: call fastcc void @fn1(ptr nocapture nofree readonly align 4 [[TMP3]]) #[[ATTR1:[0-9]+]]
21 ; TUNIT-NEXT: ret i32 undef
23 ; CGSCC: Function Attrs: mustprogress nofree nosync nounwind willreturn
24 ; CGSCC-LABEL: define {{[^@]+}}@fn2
25 ; CGSCC-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {
26 ; CGSCC-NEXT: [[TMP1:%.*]] = load i32, ptr @b, align 4
27 ; CGSCC-NEXT: [[TMP2:%.*]] = sext i32 [[TMP1]] to i64
28 ; CGSCC-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to ptr
29 ; CGSCC-NEXT: call fastcc void @fn1(ptr nocapture nofree nonnull readonly align 4 [[TMP3]]) #[[ATTR2:[0-9]+]]
30 ; CGSCC-NEXT: ret i32 undef
32 %1 = load i32, ptr @b, align 4
33 %2 = sext i32 %1 to i64
34 %3 = inttoptr i64 %2 to ptr
35 call fastcc void @fn1(ptr %3)
39 define internal fastcc void @fn1(ptr nocapture readonly) unnamed_addr {
40 ; TUNIT: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
41 ; TUNIT-LABEL: define {{[^@]+}}@fn1
42 ; TUNIT-SAME: (ptr nocapture nofree nonnull readonly align 4 [[TMP0:%.*]]) unnamed_addr #[[ATTR0]] {
43 ; TUNIT-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 -1
44 ; TUNIT-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4
45 ; TUNIT-NEXT: store i32 [[TMP3]], ptr @a, align 4
46 ; TUNIT-NEXT: ret void
48 ; CGSCC: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn
49 ; CGSCC-LABEL: define {{[^@]+}}@fn1
50 ; CGSCC-SAME: (ptr nocapture nofree nonnull readonly align 4 [[TMP0:%.*]]) unnamed_addr #[[ATTR1:[0-9]+]] {
51 ; CGSCC-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 -1
52 ; CGSCC-NEXT: [[TMP3:%.*]] = load i32, ptr [[TMP2]], align 4
53 ; CGSCC-NEXT: store i32 [[TMP3]], ptr @a, align 4
54 ; CGSCC-NEXT: ret void
56 %2 = getelementptr inbounds i32, ptr %0, i64 -1
57 %3 = load i32, ptr %2, align 4
58 store i32 %3, ptr @a, align 4
62 ; TUNIT: attributes #[[ATTR0]] = { mustprogress nofree norecurse nosync nounwind willreturn }
63 ; TUNIT: attributes #[[ATTR1]] = { nofree nosync nounwind willreturn }
65 ; CGSCC: attributes #[[ATTR0]] = { mustprogress nofree nosync nounwind willreturn }
66 ; CGSCC: attributes #[[ATTR1]] = { mustprogress nofree norecurse nosync nounwind willreturn }
67 ; CGSCC: attributes #[[ATTR2]] = { nofree nounwind willreturn }
69 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: