[llvm] [SCEV] Add PHI SCEV verification to ensure availability at loop entry (PR #127550)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 17 15:10:57 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Aleksandr Popov (aleks-tmb)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/127550.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/ScalarEvolution.cpp (+10)
``````````diff
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 8f74c1c398ced..2d1a57a72721d 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -14482,6 +14482,16 @@ void ScalarEvolution::verify() const {
<< "Delta: " << *Delta << "\n";
std::abort();
}
+
+ if (isa<PHINode>(I))
+ for (const Loop *L : ValidLoops)
+ if (SE.isAvailableAtLoopEntry(OldSCEV, L) !=
+ SE2.isAvailableAtLoopEntry(NewSCEV, L)) {
+ dbgs() << "Incorrect SCEV availability at loop entry\n"
+ << "Old: " << *OldSCEV << "\n"
+ << "New: " << *NewSCEV << "\n";
+ std::abort();
+ }
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/127550
More information about the llvm-commits
mailing list