llvm.org GIT mirror llvm / 1c5ffdf
--- Reverse-merging r80908 into '.': D test/Analysis/Profiling --- Reverse-merging r80907 into '.': U lib/Analysis/ProfileInfoLoaderPass.cpp Attempt to remove failure in the self-hosting build bot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80966 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 11 years ago
4 changed file(s) with 1 addition(s) and 346 deletion(s). Raw diff Collapse all Expand all
158158 void LoaderPass::readOrRememberEdge(ProfileInfo::Edge e,
159159 unsigned weight, unsigned ei,
160160 Function *F) {
161 if (weight != ~0U) {
161 if (weight != (unsigned)MissingValue) {
162162 EdgeInformation[F][e] += weight;
163163 DEBUG(errs()<<"--Read Edge Counter for " << e
164164 <<" (# "<
+0
-4
test/Analysis/Profiling/dg.exp less more
None load_lib llvm.exp
1
2 RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]]
3
+0
-138
test/Analysis/Profiling/edge-profiling.ll less more
None ; RUN: llvm-as < %s | opt -insert-edge-profiling | llvm-dis | tee %t1 | FileCheck %s
1
2 ; ModuleID = ''
3
4 @.str = private constant [12 x i8] c"hello world\00", align 1 ; <[12 x i8]*> [#uses=1]
5 @.str1 = private constant [6 x i8] c"franz\00", align 1 ; <[6 x i8]*> [#uses=1]
6 @.str2 = private constant [9 x i8] c"argc > 2\00", align 1 ; <[9 x i8]*> [#uses=1]
7 @.str3 = private constant [9 x i8] c"argc = 1\00", align 1 ; <[9 x i8]*> [#uses=1]
8 @.str4 = private constant [6 x i8] c"fritz\00", align 1 ; <[6 x i8]*> [#uses=1]
9 @.str5 = private constant [10 x i8] c"argc <= 1\00", align 1 ; <[10 x i8]*> [#uses=1]
10 ; CHECK:@EdgeProfCounters
11 ; CHECK:[19 x i32]
12 ; CHECK:zeroinitializer
13
14 define void @oneblock() nounwind {
15 entry:
16 ; CHECK:entry:
17 ; CHECK:%OldFuncCounter
18 ; CHECK:load
19 ; CHECK:getelementptr
20 ; CHECK:@EdgeProfCounters
21 ; CHECK:i32 0
22 ; CHECK:i32 0
23 ; CHECK:%NewFuncCounter
24 ; CHECK:add
25 ; CHECK:%OldFuncCounter
26 ; CHECK:store
27 ; CHECK:%NewFuncCounter
28 ; CHECK:getelementptr
29 ; CHECK:@EdgeProfCounters
30 %0 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.str, i64 0, i64 0)) nounwind ; [#uses=0]
31 ret void
32 }
33
34 declare i32 @puts(i8*)
35
36 define i32 @main(i32 %argc, i8** %argv) nounwind {
37 entry:
38 ; CHECK:entry:
39 %argc_addr = alloca i32 ; [#uses=4]
40 %argv_addr = alloca i8** ; [#uses=1]
41 %retval = alloca i32 ; [#uses=2]
42 %j = alloca i32 ; [#uses=4]
43 %i = alloca i32 ; [#uses=4]
44 %0 = alloca i32 ; [#uses=2]
45 ; CHECK:call
46 ; CHECK:@llvm_start_edge_profiling
47 ; CHECK:@EdgeProfCounters
48 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
49 store i32 %argc, i32* %argc_addr
50 store i8** %argv, i8*** %argv_addr
51 store i32 0, i32* %i, align 4
52 br label %bb10
53
54 bb: ; preds = %bb10
55 ; CHECK:bb:
56 %1 = load i32* %argc_addr, align 4 ; [#uses=1]
57 %2 = icmp sgt i32 %1, 1 ; [#uses=1]
58 br i1 %2, label %bb1, label %bb8
59
60 bb1: ; preds = %bb
61 ; CHECK:bb1:
62 store i32 0, i32* %j, align 4
63 br label %bb6
64
65 bb2: ; preds = %bb6
66 ; CHECK:bb2:
67 %3 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i64 0, i64 0)) nounwind ; [#uses=0]
68 %4 = load i32* %argc_addr, align 4 ; [#uses=1]
69 %5 = icmp sgt i32 %4, 2 ; [#uses=1]
70 br i1 %5, label %bb3, label %bb4
71
72 bb3: ; preds = %bb2
73 ; CHECK:bb3:
74 %6 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str2, i64 0, i64 0)) nounwind ; [#uses=0]
75 br label %bb5
76
77 bb4: ; preds = %bb2
78 ; CHECK:bb4:
79 %7 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str3, i64 0, i64 0)) nounwind ; [#uses=0]
80 br label %bb11
81
82 bb5: ; preds = %bb3
83 ; CHECK:bb5:
84 %8 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str4, i64 0, i64 0)) nounwind ; [#uses=0]
85 %9 = load i32* %j, align 4 ; [#uses=1]
86 %10 = add nsw i32 %9, 1 ; [#uses=1]
87 store i32 %10, i32* %j, align 4
88 br label %bb6
89
90 bb6: ; preds = %bb5, %bb1
91 ; CHECK:bb6:
92 %11 = load i32* %j, align 4 ; [#uses=1]
93 %12 = load i32* %argc_addr, align 4 ; [#uses=1]
94 %13 = icmp slt i32 %11, %12 ; [#uses=1]
95 br i1 %13, label %bb2, label %bb7
96
97 bb7: ; preds = %bb6
98 ; CHECK:bb7:
99 br label %bb9
100
101 bb8: ; preds = %bb
102 ; CHECK:bb8:
103 %14 = call i32 @puts(i8* getelementptr inbounds ([10 x i8]* @.str5, i64 0, i64 0)) nounwind ; [#uses=0]
104 br label %bb9
105
106 bb9: ; preds = %bb8, %bb7
107 ; CHECK:bb9:
108 %15 = load i32* %i, align 4 ; [#uses=1]
109 %16 = add nsw i32 %15, 1 ; [#uses=1]
110 store i32 %16, i32* %i, align 4
111 br label %bb10
112
113 bb10: ; preds = %bb9, %entry
114 ; CHECK:bb10:
115 %17 = load i32* %i, align 4 ; [#uses=1]
116 %18 = icmp ne i32 %17, 3 ; [#uses=1]
117 br i1 %18, label %bb, label %bb11
118 ; CHECK:br
119 ; CHECK:label %bb10.bb11_crit_edge
120
121 ; CHECK:bb10.bb11_crit_edge:
122 ; CHECK:br
123 ; CHECK:label %bb11
124
125 bb11: ; preds = %bb10, %bb4
126 ; CHECK:bb11:
127 call void @oneblock() nounwind
128 store i32 0, i32* %0, align 4
129 %19 = load i32* %0, align 4 ; [#uses=1]
130 store i32 %19, i32* %retval, align 4
131 br label %return
132
133 return: ; preds = %bb11
134 ; CHECK:return:
135 %retval12 = load i32* %retval ; [#uses=1]
136 ret i32 %retval12
137 }
+0
-203
test/Analysis/Profiling/profiling-tool-chain.ll less more
None ; RUN: llvm-as %s -o %t1
1 ; RUN: opt %t1 -insert-optimal-edge-profiling -o %t2
2
3 ; FIXME: These parts of the test are disabled for now, they aren't working on
4 ; llvm-gcc-x86_64-darwin10-selfhost.
5
6 ; RUX: llvm-dis < %t2 | FileCheck --check-prefix=INST %s
7 ; RUX: rm -f llvmprof.out
8 ; RUX: lli -load %llvmlibsdir/profile_rt%shlibext %t2
9 ; RUX: lli -load %llvmlibsdir/profile_rt%shlibext %t2 1 2
10 ; RUX: llvm-prof -print-all-code %t1 | FileCheck --check-prefix=PROF %s
11
12 ; PROF: 1. 2/4 oneblock
13 ; PROF: 2. 2/4 main
14 ; PROF: 1. 15.7895% 12/76 main() - bb6
15 ; PROF: 2. 11.8421% 9/76 main() - bb2
16 ; PROF: 3. 11.8421% 9/76 main() - bb3
17 ; PROF: 4. 11.8421% 9/76 main() - bb5
18 ; PROF: 5. 10.5263% 8/76 main() - bb10
19 ; PROF: 6. 7.89474% 6/76 main() - bb
20 ; PROF: 7. 7.89474% 6/76 main() - bb9
21 ; PROF: 8. 3.94737% 3/76 main() - bb1
22 ; PROF: 9. 3.94737% 3/76 main() - bb7
23 ; PROF: 10. 3.94737% 3/76 main() - bb8
24 ; PROF: 11. 2.63158% 2/76 oneblock() - entry
25 ; PROF: 12. 2.63158% 2/76 main() - entry
26 ; PROF: 13. 2.63158% 2/76 main() - bb11
27 ; PROF: 14. 2.63158% 2/76 main() - return
28
29 ; ModuleID = ''
30
31 @.str = private constant [12 x i8] c"hello world\00", align 1 ; <[12 x i8]*> [#uses=1]
32 @.str1 = private constant [6 x i8] c"franz\00", align 1 ; <[6 x i8]*> [#uses=1]
33 @.str2 = private constant [9 x i8] c"argc > 2\00", align 1 ; <[9 x i8]*> [#uses=1]
34 @.str3 = private constant [9 x i8] c"argc = 1\00", align 1 ; <[9 x i8]*> [#uses=1]
35 @.str4 = private constant [6 x i8] c"fritz\00", align 1 ; <[6 x i8]*> [#uses=1]
36 @.str5 = private constant [10 x i8] c"argc <= 1\00", align 1 ; <[10 x i8]*> [#uses=1]
37 ; INST:@OptEdgeProfCounters
38 ; INST:[21 x i32]
39 ; INST:[i32 0,
40 ; INST:i32 -1,
41 ; INST:i32 -1,
42 ; INST:i32 -1,
43 ; INST:i32 -1,
44 ; INST:i32 -1,
45 ; INST:i32 -1,
46 ; INST:i32 -1,
47 ; INST:i32 -1,
48 ; INST:i32 0,
49 ; INST:i32 0,
50 ; INST:i32 -1,
51 ; INST:i32 -1,
52 ; INST:i32 -1,
53 ; INST:i32 0,
54 ; INST:i32 0,
55 ; INST:i32 -1,
56 ; INST:i32 -1,
57 ; INST:i32 0,
58 ; INST:i32 -1,
59 ; INST:i32 -1]
60
61 ; PROF:;;; %oneblock called 2 times.
62 ; PROF:;;;
63 define void @oneblock() nounwind {
64 entry:
65 ; PROF:entry:
66 ; PROF: ;;; Basic block executed 2 times.
67 %0 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @.str, i64 0, i64 0)) nounwind ; [#uses=0]
68 ret void
69 }
70
71 declare i32 @puts(i8*)
72
73 ; PROF:;;; %main called 2 times.
74 ; PROF:;;;
75 define i32 @main(i32 %argc, i8** %argv) nounwind {
76 entry:
77 ; PROF:entry:
78 ; PROF: ;;; Basic block executed 2 times.
79 %argc_addr = alloca i32 ; [#uses=4]
80 %argv_addr = alloca i8** ; [#uses=1]
81 %retval = alloca i32 ; [#uses=2]
82 %j = alloca i32 ; [#uses=4]
83 %i = alloca i32 ; [#uses=4]
84 %0 = alloca i32 ; [#uses=2]
85 ; INST:call
86 ; INST:@llvm_start_opt_edge_profiling
87 ; INST:@OptEdgeProfCounters
88 %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
89 store i32 %argc, i32* %argc_addr
90 store i8** %argv, i8*** %argv_addr
91 store i32 0, i32* %i, align 4
92 br label %bb10
93 ; PROF: ;;; Out-edge counts: [2.000000e+00 -> bb10]
94
95 bb: ; preds = %bb10
96 ; PROF:bb:
97 ; PROF: ;;; Basic block executed 6 times.
98 %1 = load i32* %argc_addr, align 4 ; [#uses=1]
99 %2 = icmp sgt i32 %1, 1 ; [#uses=1]
100 br i1 %2, label %bb1, label %bb8
101 ; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb1] [3.000000e+00 -> bb8]
102
103 bb1: ; preds = %bb
104 ; PROF:bb1:
105 ; PROF: ;;; Basic block executed 3 times.
106 store i32 0, i32* %j, align 4
107 br label %bb6
108 ; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb6]
109
110 bb2: ; preds = %bb6
111 ; PROF:bb2:
112 ; PROF: ;;; Basic block executed 9 times.
113 %3 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str1, i64 0, i64 0)) nounwind ; [#uses=0]
114 %4 = load i32* %argc_addr, align 4 ; [#uses=1]
115 %5 = icmp sgt i32 %4, 2 ; [#uses=1]
116 br i1 %5, label %bb3, label %bb4
117 ; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb3]
118
119 bb3: ; preds = %bb2
120 ; PROF:bb3:
121 ; PROF: ;;; Basic block executed 9 times.
122 %6 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str2, i64 0, i64 0)) nounwind ; [#uses=0]
123 br label %bb5
124 ; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb5]
125
126 bb4: ; preds = %bb2
127 ; PROF:bb4:
128 ; PROF: ;;; Never executed!
129 %7 = call i32 @puts(i8* getelementptr inbounds ([9 x i8]* @.str3, i64 0, i64 0)) nounwind ; [#uses=0]
130 br label %bb11
131
132 bb5: ; preds = %bb3
133 ; PROF:bb5:
134 ; PROF: ;;; Basic block executed 9 times.
135 %8 = call i32 @puts(i8* getelementptr inbounds ([6 x i8]* @.str4, i64 0, i64 0)) nounwind ; [#uses=0]
136 %9 = load i32* %j, align 4 ; [#uses=1]
137 %10 = add nsw i32 %9, 1 ; [#uses=1]
138 store i32 %10, i32* %j, align 4
139 br label %bb6
140 ; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb6]
141
142 bb6: ; preds = %bb5, %bb1
143 ; PROF:bb6:
144 ; PROF: ;;; Basic block executed 12 times.
145 %11 = load i32* %j, align 4 ; [#uses=1]
146 %12 = load i32* %argc_addr, align 4 ; [#uses=1]
147 %13 = icmp slt i32 %11, %12 ; [#uses=1]
148 br i1 %13, label %bb2, label %bb7
149 ; PROF: ;;; Out-edge counts: [9.000000e+00 -> bb2] [3.000000e+00 -> bb7]
150
151 bb7: ; preds = %bb6
152 ; PROF:bb7:
153 ; PROF: ;;; Basic block executed 3 times.
154 br label %bb9
155 ; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb9]
156
157 bb8: ; preds = %bb
158 ; PROF:bb8:
159 ; PROF: ;;; Basic block executed 3 times.
160 %14 = call i32 @puts(i8* getelementptr inbounds ([10 x i8]* @.str5, i64 0, i64 0)) nounwind ; [#uses=0]
161 br label %bb9
162 ; PROF: ;;; Out-edge counts: [3.000000e+00 -> bb9]
163
164 bb9: ; preds = %bb8, %bb7
165 ; PROF:bb9:
166 ; PROF: ;;; Basic block executed 6 times.
167 %15 = load i32* %i, align 4 ; [#uses=1]
168 %16 = add nsw i32 %15, 1 ; [#uses=1]
169 store i32 %16, i32* %i, align 4
170 br label %bb10
171 ; PROF: ;;; Out-edge counts: [6.000000e+00 -> bb10]
172
173 bb10: ; preds = %bb9, %entry
174 ; PROF:bb10:
175 ; PROF: ;;; Basic block executed 8 times.
176 %17 = load i32* %i, align 4 ; [#uses=1]
177 %18 = icmp ne i32 %17, 3 ; [#uses=1]
178 br i1 %18, label %bb, label %bb11
179 ; INST:br
180 ; INST:label %bb10.bb11_crit_edge
181 ; PROF: ;;; Out-edge counts: [6.000000e+00 -> bb] [2.000000e+00 -> bb11]
182
183 ; INST:bb10.bb11_crit_edge:
184 ; INST:br
185 ; INST:label %bb11
186
187 bb11: ; preds = %bb10, %bb4
188 ; PROF:bb11:
189 ; PROF: ;;; Basic block executed 2 times.
190 call void @oneblock() nounwind
191 store i32 0, i32* %0, align 4
192 %19 = load i32* %0, align 4 ; [#uses=1]
193 store i32 %19, i32* %retval, align 4
194 br label %return
195 ; PROF: ;;; Out-edge counts: [2.000000e+00 -> return]
196
197 return: ; preds = %bb11
198 ; PROF:return:
199 ; PROF: ;;; Basic block executed 2 times.
200 %retval12 = load i32* %retval ; [#uses=1]
201 ret i32 %retval12
202 }