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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 06:28:28 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))) {
----------------
nikic wrote:

Yeah, SCEVs are uniqued, so a SCEV with the same args will have the same pointer. (Of course, it's possible that expressions are equal in ways that SCEV doesn't understand, but we'd consider that a canonicalization failure.)

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


More information about the llvm-commits mailing list