Skip to content

Commit 73e6bc6

Browse files
committed
replace isa<InvokeInst> with generic check for terminator
1 parent 83986a4 commit 73e6bc6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4985,9 +4985,15 @@ InstCombinerImpl::pushFreezeToPreventPoisonFromPropagating(FreezeInst &OrigFI) {
49854985
SmallPtrSet<BasicBlock *, 8> VisitedBBs;
49864986
for (Use &U : PN->incoming_values()) {
49874987
BasicBlock *InBB = PN->getIncomingBlock(U);
4988+
// We can't move freeze if the start value is the result of a
4989+
// terminator (e.g. an invoke).
4990+
if (auto *OpI = dyn_cast<Instruction>(U)) {
4991+
if (OpI->isTerminator())
4992+
return false;
4993+
}
4994+
49884995
if (DT.dominates(BB, InBB) || isBackEdge(InBB, BB) ||
4989-
isa<InvokeInst>(U) || VisitedBBs.contains(InBB) ||
4990-
match(U.get(), m_Undef()))
4996+
VisitedBBs.contains(InBB) || match(U.get(), m_Undef()))
49914997
return false;
49924998
VisitedBBs.insert(InBB);
49934999
}

0 commit comments

Comments
 (0)