@@ -162,13 +162,10 @@ class GuardWideningImpl {
162
162
static StringRef scoreTypeToString (WideningScore WS);
163
163
164
164
// / Compute the score for widening the condition in \p DominatedGuard
165
- // / (contained in \p DominatedGuardLoop) into \p DominatingGuard (contained in
166
- // / \p DominatingGuardLoop). If \p InvertCond is set, then we widen the
165
+ // / into \p DominatingGuard. If \p InvertCond is set, then we widen the
167
166
// / inverted condition of the dominating guard.
168
167
WideningScore computeWideningScore (Instruction *DominatedGuard,
169
- Loop *DominatedGuardLoop,
170
168
Instruction *DominatingGuard,
171
- Loop *DominatingGuardLoop,
172
169
bool InvertCond);
173
170
174
171
// / Helper to check if \p V can be hoisted to \p InsertPos.
@@ -349,15 +346,13 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
349
346
350
347
Instruction *BestSoFar = nullptr ;
351
348
auto BestScoreSoFar = WS_IllegalOrNegative;
352
- auto *GuardInstLoop = LI.getLoopFor (GuardInst->getParent ());
353
349
354
350
// In the set of dominating guards, find the one we can merge GuardInst with
355
351
// for the most profit.
356
352
for (unsigned i = 0 , e = DFSI.getPathLength (); i != e; ++i) {
357
353
auto *CurBB = DFSI.getPath (i)->getBlock ();
358
354
if (!BlockFilter (CurBB))
359
355
break ;
360
- auto *CurLoop = LI.getLoopFor (CurBB);
361
356
assert (GuardsInBlock.count (CurBB) && " Must have been populated by now!" );
362
357
const auto &GuardsInCurBB = GuardsInBlock.find (CurBB)->second ;
363
358
@@ -390,9 +385,7 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
390
385
}
391
386
392
387
for (auto *Candidate : make_range (I, E)) {
393
- auto Score =
394
- computeWideningScore (GuardInst, GuardInstLoop, Candidate, CurLoop,
395
- InvertCondition);
388
+ auto Score = computeWideningScore (GuardInst, Candidate, InvertCondition);
396
389
LLVM_DEBUG (dbgs () << " Score between " << *getCondition (GuardInst)
397
390
<< " and " << *getCondition (Candidate) << " is "
398
391
<< scoreTypeToString (Score) << " \n " );
@@ -424,9 +417,12 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
424
417
return true ;
425
418
}
426
419
427
- GuardWideningImpl::WideningScore GuardWideningImpl::computeWideningScore (
428
- Instruction *DominatedGuard, Loop *DominatedGuardLoop,
429
- Instruction *DominatingGuard, Loop *DominatingGuardLoop, bool InvertCond) {
420
+ GuardWideningImpl::WideningScore
421
+ GuardWideningImpl::computeWideningScore (Instruction *DominatedGuard,
422
+ Instruction *DominatingGuard,
423
+ bool InvertCond) {
424
+ Loop *DominatedGuardLoop = LI.getLoopFor (DominatedGuard->getParent ());
425
+ Loop *DominatingGuardLoop = LI.getLoopFor (DominatingGuard->getParent ());
430
426
bool HoistingOutOfLoop = false ;
431
427
432
428
if (DominatingGuardLoop != DominatedGuardLoop) {
0 commit comments