@@ -223,6 +223,11 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) {
223
223
Instruction *Second = I != First ? I : Other; // Get iterator to second inst
224
224
BI = Second;
225
225
226
+ if (isa<LoadInst>(Second))
227
+ ++NumLoadRemoved; // Keep track of loads eliminated
228
+ if (isa<CallInst>(Second))
229
+ ++NumCallRemoved; // Keep track of calls eliminated
230
+
226
231
// Destroy Second, using First instead.
227
232
ReplaceInstWithInst (First, BI);
228
233
Ret = First;
@@ -231,9 +236,19 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) {
231
236
// dominates the other instruction, we can simply use it
232
237
//
233
238
} else if (DomSetInfo->dominates (BB1, BB2)) { // I dom Other?
239
+ if (isa<LoadInst>(Other))
240
+ ++NumLoadRemoved; // Keep track of loads eliminated
241
+ if (isa<CallInst>(Other))
242
+ ++NumCallRemoved; // Keep track of calls eliminated
243
+
234
244
ReplaceInstWithInst (I, Other);
235
245
Ret = I;
236
246
} else if (DomSetInfo->dominates (BB2, BB1)) { // Other dom I?
247
+ if (isa<LoadInst>(I))
248
+ ++NumLoadRemoved; // Keep track of loads eliminated
249
+ if (isa<CallInst>(I))
250
+ ++NumCallRemoved; // Keep track of calls eliminated
251
+
237
252
ReplaceInstWithInst (Other, I);
238
253
Ret = Other;
239
254
} else {
@@ -266,10 +281,6 @@ Instruction *GCSE::EliminateCSE(Instruction *I, Instruction *Other) {
266
281
return 0 ;
267
282
}
268
283
269
- if (isa<LoadInst>(Ret))
270
- ++NumLoadRemoved; // Keep track of loads eliminated
271
- if (isa<CallInst>(Ret))
272
- ++NumCallRemoved; // Keep track of calls eliminated
273
284
++NumInstRemoved; // Keep track of number of instructions eliminated
274
285
275
286
// Add all users of Ret to the worklist...
0 commit comments