[llvm] [LoopVectorize] Improve algorithm for hoisting runtime checks (PR #73515)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 06:23:16 PST 2023


================
@@ -346,7 +346,10 @@ void RuntimePointerChecking::tryToCreateDiffCheck(
     auto *SinkStartAR = cast<SCEVAddRecExpr>(SinkStartInt);
     const Loop *StartARLoop = SrcStartAR->getLoop();
     if (StartARLoop == SinkStartAR->getLoop() &&
-        StartARLoop == InnerLoop->getParentLoop()) {
+        StartARLoop == InnerLoop->getParentLoop() &&
+        !SE->isKnownPredicate(ICmpInst::ICMP_EQ,
+                              SrcStartAR->getStepRecurrence(*SE),
+                              SinkStartAR->getStepRecurrence(*SE))) {
----------------
david-arm wrote:

Thanks for the suggestion! I wasn't sure if two SCEVs with the same underlying expression were guaranteed to have the same pointer, but it makes sense that we reuse objects.

https://github.com/llvm/llvm-project/pull/73515


More information about the llvm-commits mailing list