Skip to content

Commit 13ab5cb

Browse files
author
Max Kazantsev
committed
[NFC] Remove redundant parameters for better readability
llvm-svn: 353034
1 parent 20bef45 commit 13ab5cb

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

llvm/lib/Transforms/Scalar/GuardWidening.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,10 @@ class GuardWideningImpl {
162162
static StringRef scoreTypeToString(WideningScore WS);
163163

164164
/// 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
167166
/// inverted condition of the dominating guard.
168167
WideningScore computeWideningScore(Instruction *DominatedGuard,
169-
Loop *DominatedGuardLoop,
170168
Instruction *DominatingGuard,
171-
Loop *DominatingGuardLoop,
172169
bool InvertCond);
173170

174171
/// Helper to check if \p V can be hoisted to \p InsertPos.
@@ -349,15 +346,13 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
349346

350347
Instruction *BestSoFar = nullptr;
351348
auto BestScoreSoFar = WS_IllegalOrNegative;
352-
auto *GuardInstLoop = LI.getLoopFor(GuardInst->getParent());
353349

354350
// In the set of dominating guards, find the one we can merge GuardInst with
355351
// for the most profit.
356352
for (unsigned i = 0, e = DFSI.getPathLength(); i != e; ++i) {
357353
auto *CurBB = DFSI.getPath(i)->getBlock();
358354
if (!BlockFilter(CurBB))
359355
break;
360-
auto *CurLoop = LI.getLoopFor(CurBB);
361356
assert(GuardsInBlock.count(CurBB) && "Must have been populated by now!");
362357
const auto &GuardsInCurBB = GuardsInBlock.find(CurBB)->second;
363358

@@ -390,9 +385,7 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
390385
}
391386

392387
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);
396389
LLVM_DEBUG(dbgs() << "Score between " << *getCondition(GuardInst)
397390
<< " and " << *getCondition(Candidate) << " is "
398391
<< scoreTypeToString(Score) << "\n");
@@ -424,9 +417,12 @@ bool GuardWideningImpl::eliminateGuardViaWidening(
424417
return true;
425418
}
426419

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());
430426
bool HoistingOutOfLoop = false;
431427

432428
if (DominatingGuardLoop != DominatedGuardLoop) {

0 commit comments

Comments
 (0)