Skip to content

Commit 3eb0799

Browse files
authored
[GVN][NFCI] Use early return in phiTranslateImpl() (#149273)
1 parent fb81a0d commit 3eb0799

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,11 +2367,14 @@ uint32_t GVNPass::ValueTable::phiTranslateImpl(const BasicBlock *Pred,
23672367
// See if we can refine the value number by looking at the PN incoming value
23682368
// for the given predecessor.
23692369
if (PHINode *PN = NumberingPhi[Num]) {
2370-
if (PN->getParent() == PhiBlock)
2371-
for (unsigned I = 0; I != PN->getNumIncomingValues(); ++I)
2372-
if (PN->getIncomingBlock(I) == Pred)
2373-
if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false))
2374-
return TransVal;
2370+
if (PN->getParent() != PhiBlock)
2371+
return Num;
2372+
for (unsigned I = 0; I != PN->getNumIncomingValues(); ++I) {
2373+
if (PN->getIncomingBlock(I) != Pred)
2374+
continue;
2375+
if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false))
2376+
return TransVal;
2377+
}
23752378
return Num;
23762379
}
23772380

0 commit comments

Comments
 (0)