Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions llvm/lib/Transforms/Scalar/GVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2367,12 +2367,15 @@ uint32_t GVNPass::ValueTable::phiTranslateImpl(const BasicBlock *Pred,
// See if we can refine the value number by looking at the PN incoming value
// for the given predecessor.
if (PHINode *PN = NumberingPhi[Num]) {
if (PN->getParent() == PhiBlock)
for (unsigned I = 0; I != PN->getNumIncomingValues(); ++I)
if (PN->getIncomingBlock(I) == Pred)
if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false))
return TransVal;
return Num;
if (PN->getParent() != PhiBlock)
return Num;

for (unsigned I = 0; I != PN->getNumIncomingValues(); ++I) {
if (PN->getIncomingBlock(I) != Pred)
continue;
if (uint32_t TransVal = lookup(PN->getIncomingValue(I), false))
return TransVal;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously we would return Num; if no translated incoming value could be found, now we fall through.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, realized this. Reverted in #149270

}

if (BasicBlock *BB = NumberingBB[Num]) {
Expand Down
Loading