1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-attributes --check-globals
2 ; RUN: opt -attributor -enable-new-pm=0 -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_NPM,NOT_CGSCC_OPM,NOT_TUNIT_NPM,IS__TUNIT____,IS________OPM,IS__TUNIT_OPM
3 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor -attributor-manifest-internal -attributor-max-iterations-verify -attributor-annotate-decl-cs -attributor-max-iterations=7 -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_CGSCC_OPM,NOT_CGSCC_NPM,NOT_TUNIT_OPM,IS__TUNIT____,IS________NPM,IS__TUNIT_NPM
4 ; RUN: opt -attributor-cgscc -enable-new-pm=0 -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_NPM,IS__CGSCC____,IS________OPM,IS__CGSCC_OPM
5 ; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s | FileCheck %s --check-prefixes=CHECK,NOT_TUNIT_NPM,NOT_TUNIT_OPM,NOT_CGSCC_OPM,IS__CGSCC____,IS________NPM,IS__CGSCC_NPM
8 @b = common local_unnamed_addr global i32 0, align 4
9 @a = common local_unnamed_addr global i32 0, align 4
12 ; CHECK: @[[B:[a-zA-Z0-9_$"\\.-]+]] = common local_unnamed_addr global i32 0, align 4
13 ; CHECK: @[[A:[a-zA-Z0-9_$"\\.-]+]] = common local_unnamed_addr global i32 0, align 4
15 define i32 @fn2() local_unnamed_addr {
16 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn
17 ; IS__TUNIT____-LABEL: define {{[^@]+}}@fn2
18 ; IS__TUNIT____-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {
19 ; IS__TUNIT____-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
20 ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = sext i32 [[TMP1]] to i64
21 ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to i32*
22 ; IS__TUNIT____-NEXT: call fastcc void @fn1(i32* nocapture nofree readonly align 4 [[TMP3]]) #[[ATTR0]]
23 ; IS__TUNIT____-NEXT: ret i32 undef
25 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn
26 ; IS__CGSCC____-LABEL: define {{[^@]+}}@fn2
27 ; IS__CGSCC____-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {
28 ; IS__CGSCC____-NEXT: [[TMP1:%.*]] = load i32, i32* @b, align 4
29 ; IS__CGSCC____-NEXT: [[TMP2:%.*]] = sext i32 [[TMP1]] to i64
30 ; IS__CGSCC____-NEXT: [[TMP3:%.*]] = inttoptr i64 [[TMP2]] to i32*
31 ; IS__CGSCC____-NEXT: call fastcc void @fn1(i32* nocapture nofree nonnull readonly align 4 [[TMP3]]) #[[ATTR1:[0-9]+]]
32 ; IS__CGSCC____-NEXT: ret i32 undef
34 %1 = load i32, i32* @b, align 4
35 %2 = sext i32 %1 to i64
36 %3 = inttoptr i64 %2 to i32*
37 call fastcc void @fn1(i32* %3)
41 define internal fastcc void @fn1(i32* nocapture readonly) unnamed_addr {
42 ; IS__TUNIT____: Function Attrs: nofree nosync nounwind willreturn
43 ; IS__TUNIT____-LABEL: define {{[^@]+}}@fn1
44 ; IS__TUNIT____-SAME: (i32* nocapture nofree nonnull readonly align 4 [[TMP0:%.*]]) unnamed_addr #[[ATTR0]] {
45 ; IS__TUNIT____-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 -1
46 ; IS__TUNIT____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4
47 ; IS__TUNIT____-NEXT: store i32 [[TMP3]], i32* @a, align 4
48 ; IS__TUNIT____-NEXT: ret void
50 ; IS__CGSCC____: Function Attrs: nofree norecurse nosync nounwind willreturn
51 ; IS__CGSCC____-LABEL: define {{[^@]+}}@fn1
52 ; IS__CGSCC____-SAME: (i32* nocapture nofree nonnull readonly align 4 [[TMP0:%.*]]) unnamed_addr #[[ATTR0]] {
53 ; IS__CGSCC____-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 -1
54 ; IS__CGSCC____-NEXT: [[TMP3:%.*]] = load i32, i32* [[TMP2]], align 4
55 ; IS__CGSCC____-NEXT: store i32 [[TMP3]], i32* @a, align 4
56 ; IS__CGSCC____-NEXT: ret void
58 %2 = getelementptr inbounds i32, i32* %0, i64 -1
59 %3 = load i32, i32* %2, align 4
60 store i32 %3, i32* @a, align 4
64 ; IS__TUNIT____: attributes #[[ATTR0]] = { nofree nosync nounwind willreturn }
66 ; IS__CGSCC____: attributes #[[ATTR0]] = { nofree norecurse nosync nounwind willreturn }
67 ; IS__CGSCC____: attributes #[[ATTR1]] = { nounwind willreturn }