================
@@ -1251,8 +1251,14 @@ bool
LoopInterchangeLegality::checkInductionsAndReductions(Loop *OuterLoop) {
for (PHINode &PHI : CurLoop->getHeader()->phis()) {
InductionDescriptor ID;
if (InductionDescriptor::isInductionPHI(&PHI, CurLoop, SE, ID)) {
- if (CurLoop == InnerLoop)
+ if (CurLoop == InnerLoop) {
+ const SCEV *Step = ID.getStep();
+ if (!SE->isLoopInvariant(Step, OuterLoop)) {
+ InnerLoopInductions.clear();
----------------
nikic wrote:
Explicit clear necessary? I'd assume the whole result to get discarded if we
return false. Otherwise this would also be necessary in other places.
https://github.com/llvm/llvm-project/pull/202751
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits