1 ; RUN: opt -mtriple=arm-arm-none-eabi -consthoist -S < %s | FileCheck %s
2 ; RUN: opt -mtriple=arm-arm-none-eabi -consthoist -pgso -S < %s | FileCheck %s -check-prefix=PGSO
3 ; RUN: opt -mtriple=arm-arm-none-eabi -consthoist -pgso=false -S < %s | FileCheck %s -check-prefix=NPGSO
5 ; There are different candidates here for the base constant: 1073876992 and
6 ; 1073876996. But we don't want to see the latter because it results in
9 define void @foo() #0 {
12 ; CHECK-NOT: [[CONST1:%const_mat[0-9]*]] = add i32 %const, -4
13 ; CHECK-LABEL: @foo_pgso
14 %0 = load volatile i32, i32* inttoptr (i32 1073876992 to i32*), align 4096
16 store volatile i32 %or, i32* inttoptr (i32 1073876992 to i32*), align 4096
17 %1 = load volatile i32, i32* inttoptr (i32 1073876996 to i32*), align 4
18 %and = and i32 %1, -117506048
19 store volatile i32 %and, i32* inttoptr (i32 1073876996 to i32*), align 4
20 %2 = load volatile i32, i32* inttoptr (i32 1073876992 to i32*), align 4096
21 %and1 = and i32 %2, -17367041
22 store volatile i32 %and1, i32* inttoptr (i32 1073876996 to i32*), align 4096
23 %3 = load volatile i32, i32* inttoptr (i32 1073876992 to i32*), align 4096
24 %and2 = and i32 %3, -262145
25 store volatile i32 %and2, i32* inttoptr (i32 1073876992 to i32*), align 4096
26 %4 = load volatile i32, i32* inttoptr (i32 1073876996 to i32*), align 4
27 %and3 = and i32 %4, -8323073
28 store volatile i32 %and3, i32* inttoptr (i32 1073876996 to i32*), align 4
29 store volatile i32 10420224, i32* inttoptr (i32 1073877000 to i32*), align 8
30 %5 = load volatile i32, i32* inttoptr (i32 1073876996 to i32*), align 4096
31 %or4 = or i32 %5, 65536
32 store volatile i32 %or4, i32* inttoptr (i32 1073876996 to i32*), align 4096
33 %6 = load volatile i32, i32* inttoptr (i32 1073881088 to i32*), align 8192
34 %or6.i.i = or i32 %6, 16
35 store volatile i32 %or6.i.i, i32* inttoptr (i32 1073881088 to i32*), align 8192
36 %7 = load volatile i32, i32* inttoptr (i32 1073881088 to i32*), align 8192
37 %and7.i.i = and i32 %7, -4
38 store volatile i32 %and7.i.i, i32* inttoptr (i32 1073881088 to i32*), align 8192
39 %8 = load volatile i32, i32* inttoptr (i32 1073881088 to i32*), align 8192
40 %or8.i.i = or i32 %8, 2
41 store volatile i32 %or8.i.i, i32* inttoptr (i32 1073881088 to i32*), align 8192
45 attributes #0 = { minsize norecurse nounwind optsize readnone uwtable }
47 define void @foo_pgso() #1 !prof !14 {
49 ; PGSO-LABEL: @foo_pgso
50 ; PGSO-NOT: [[CONST2:%const_mat[0-9]*]] = add i32 %const, -4
51 ; NPGSO-LABEL: @foo_pgso
52 ; NPGSO: [[CONST2:%const_mat[0-9]*]] = add i32 %const, -4
53 %0 = load volatile i32, i32* inttoptr (i32 1073876992 to i32*), align 4096
55 store volatile i32 %or, i32* inttoptr (i32 1073876992 to i32*), align 4096
56 %1 = load volatile i32, i32* inttoptr (i32 1073876996 to i32*), align 4
57 %and = and i32 %1, -117506048
58 store volatile i32 %and, i32* inttoptr (i32 1073876996 to i32*), align 4
59 %2 = load volatile i32, i32* inttoptr (i32 1073876992 to i32*), align 4096
60 %and1 = and i32 %2, -17367041
61 store volatile i32 %and1, i32* inttoptr (i32 1073876996 to i32*), align 4096
62 %3 = load volatile i32, i32* inttoptr (i32 1073876992 to i32*), align 4096
63 %and2 = and i32 %3, -262145
64 store volatile i32 %and2, i32* inttoptr (i32 1073876992 to i32*), align 4096
65 %4 = load volatile i32, i32* inttoptr (i32 1073876996 to i32*), align 4
66 %and3 = and i32 %4, -8323073
67 store volatile i32 %and3, i32* inttoptr (i32 1073876996 to i32*), align 4
68 store volatile i32 10420224, i32* inttoptr (i32 1073877000 to i32*), align 8
69 %5 = load volatile i32, i32* inttoptr (i32 1073876996 to i32*), align 4096
70 %or4 = or i32 %5, 65536
71 store volatile i32 %or4, i32* inttoptr (i32 1073876996 to i32*), align 4096
72 %6 = load volatile i32, i32* inttoptr (i32 1073881088 to i32*), align 8192
73 %or6.i.i = or i32 %6, 16
74 store volatile i32 %or6.i.i, i32* inttoptr (i32 1073881088 to i32*), align 8192
75 %7 = load volatile i32, i32* inttoptr (i32 1073881088 to i32*), align 8192
76 %and7.i.i = and i32 %7, -4
77 store volatile i32 %and7.i.i, i32* inttoptr (i32 1073881088 to i32*), align 8192
78 %8 = load volatile i32, i32* inttoptr (i32 1073881088 to i32*), align 8192
79 %or8.i.i = or i32 %8, 2
80 store volatile i32 %or8.i.i, i32* inttoptr (i32 1073881088 to i32*), align 8192
84 attributes #1 = { norecurse nounwind readnone uwtable } ; no optsize or minsize
86 !llvm.module.flags = !{!0}
87 !0 = !{i32 1, !"ProfileSummary", !1}
88 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
89 !2 = !{!"ProfileFormat", !"InstrProf"}
90 !3 = !{!"TotalCount", i64 10000}
91 !4 = !{!"MaxCount", i64 10}
92 !5 = !{!"MaxInternalCount", i64 1}
93 !6 = !{!"MaxFunctionCount", i64 1000}
94 !7 = !{!"NumCounts", i64 3}
95 !8 = !{!"NumFunctions", i64 3}
96 !9 = !{!"DetailedSummary", !10}
97 !10 = !{!11, !12, !13}
98 !11 = !{i32 10000, i64 100, i32 1}
99 !12 = !{i32 999000, i64 100, i32 1}
100 !13 = !{i32 999999, i64 1, i32 2}
101 !14 = !{!"function_entry_count", i64 0}