Skip to content

Commit df6755d

Browse files
committed
address comments
1 parent c0d7cde commit df6755d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4983,11 +4983,13 @@ InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating(FreezeInst &OrigFI) {
49834983
if (auto *PN = dyn_cast<PHINode>(V)) {
49844984
BasicBlock *BB = PN->getParent();
49854985
SmallPtrSet<BasicBlock *, 8> VisitedBBs;
4986-
for (Use &U : PN->incoming_values()) {
4987-
BasicBlock *InBB = PN->getIncomingBlock(U);
4986+
for (unsigned I = 0; I < PN->getNumIncomingValues(); ++I) {
4987+
Value *InV = PN->getIncomingValue(I);
4988+
BasicBlock *InBB = PN->getIncomingBlock(I);
4989+
49884990
// We can't move freeze if the start value is the result of a
49894991
// terminator (e.g. an invoke).
4990-
if (auto *OpI = dyn_cast<Instruction>(U)) {
4992+
if (auto *OpI = dyn_cast<Instruction>(InV)) {
49914993
if (OpI->isTerminator())
49924994
return false;
49934995
}
@@ -4997,7 +4999,7 @@ InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating(FreezeInst &OrigFI) {
49974999
// invalidating the iterator. We simply don't support this case, but it
49985000
// could be handled if there's a use case.
49995001
if (isBackEdge(InBB, BB) || !VisitedBBs.insert(InBB).second ||
5000-
match(U.get(), m_Undef()))
5002+
match(InV, m_Undef()))
50015003
return false;
50025004
VisitedBBs.insert(InBB);
50035005
}

0 commit comments

Comments
 (0)