[llvm] [ConstraintElim] Bail out non-dedicated exits when adding exiting conditions (PR #116627)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 06:21:54 PST 2024
================
@@ -1034,18 +1034,21 @@ void State::addInfoForInductions(BasicBlock &BB) {
DTN, CmpInst::ICMP_SLT, PN, B,
ConditionTy(CmpInst::ICMP_SLE, StartValue, B)));
- // Try to add condition from header to the exit blocks. When exiting either
- // with EQ or NE in the header, we know that the induction value must be u<=
- // B, as other exits may only exit earlier.
+ // Try to add condition from header to the dedicated exit blocks. When exiting
+ // either with EQ or NE in the header, we know that the induction value must
+ // be u<= B, as other exits may only exit earlier.
assert(!StepOffset.isNegative() && "induction must be increasing");
assert((Pred == CmpInst::ICMP_EQ || Pred == CmpInst::ICMP_NE) &&
"unsupported predicate");
ConditionTy Precond = {CmpInst::ICMP_ULE, StartValue, B};
SmallVector<BasicBlock *> ExitBBs;
L->getExitBlocks(ExitBBs);
for (BasicBlock *EB : ExitBBs) {
- WorkList.emplace_back(FactOrCheck::getConditionFact(
- DT.getNode(EB), CmpInst::ICMP_ULE, A, B, Precond));
+ // bail out non-dedicated exits.
+ if (DT.dominates(PN, EB)) {
----------------
nikic wrote:
```suggestion
if (DT.dominates(&BB, EB)) {
```
https://github.com/llvm/llvm-project/pull/116627
More information about the llvm-commits
mailing list