[llvm] [SCEV] Require that addrec operands dominate the loop (PR #67030)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 21 11:20:46 PDT 2023
================
@@ -3670,9 +3670,12 @@ ScalarEvolution::getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands,
"SCEVAddRecExpr operand types don't match!");
assert(!Operands[i]->getType()->isPointerTy() && "Step must be integer");
}
- for (unsigned i = 0, e = Operands.size(); i != e; ++i)
+ for (unsigned i = 0, e = Operands.size(); i != e; ++i) {
assert(isLoopInvariant(Operands[i], L) &&
"SCEVAddRecExpr operand is not loop-invariant!");
+ assert(properlyDominates(Operands[i], L->getHeader()) &&
----------------
nikic wrote:
It looks like we have a separate predicate isAvailableAtLoopEntry() which is isLoopInvariant() && properlyDominates(). I would not be surprised if many of our isLoopInvariant() uses should really be isAvailableAtLoopEntry() uses.
I can try changing the isLoopInvariant() definition and see whether anything breaks.
https://github.com/llvm/llvm-project/pull/67030
More information about the llvm-commits
mailing list