Skip to content

Commit 1d398a9

Browse files
authored
[GVN][NFC] Use early return in phiTranslateImpl() (#149268)
1 parent 3071fe5 commit 1d398a9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

llvm/lib/Transforms/Scalar/GVN.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,12 +2367,15 @@ 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;
2375-
return Num;
2370+
if (PN->getParent() != PhiBlock)
2371+
return Num;
2372+
2373+
for (unsigned I = 0; I != PN->getNumIncomingValues(); ++I) {
2374+
if (PN->getIncomingBlock(I) != Pred)
2375+
continue;
2376+
if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false))
2377+
return TransVal;
2378+
}
23762379
}
23772380

23782381
if (BasicBlock *BB = NumberingBB[Num]) {

0 commit comments

Comments
 (0)