Skip to content

Commit 6575ceb

Browse files
committed
review
1 parent df43d29 commit 6575ceb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/Scalar/StructurizeCFG.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,11 @@ bool StructurizeCFG::isHoistableInstruction(Instruction *I, BasicBlock *BB,
445445
if (CostVal != 0)
446446
return false;
447447

448-
// Check if any operands are instructions defined in the same block.
448+
// Check if all operands are available at the hoisting destination.
449449
for (auto &Op : I->operands()) {
450450
if (auto *OpI = dyn_cast<Instruction>(Op)) {
451-
if (OpI->getParent() == BB || !DT->dominates(OpI->getParent(), HoistTo))
451+
// Operand must dominate the hoisting destination.
452+
if (!DT->dominates(OpI->getParent(), HoistTo))
452453
return false;
453454
}
454455
}

0 commit comments

Comments
 (0)