[llvm] [clang] [clang-tools-extra] [LoopVectorize] Improve algorithm for hoisting runtime checks (PR #73515)

Paul Walker via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 11 03:39:09 PST 2023


================
@@ -347,7 +347,12 @@ void RuntimePointerChecking::tryToCreateDiffCheck(
     auto *SinkStartAR = cast<SCEVAddRecExpr>(SinkStartInt);
     const Loop *StartARLoop = SrcStartAR->getLoop();
     if (StartARLoop == SinkStartAR->getLoop() &&
-        StartARLoop == InnerLoop->getParentLoop()) {
+        StartARLoop == InnerLoop->getParentLoop() &&
+        // If the diff check would already be loop invariant (due to the
+        // recurrences being the same), then we should still prefer the diff
----------------
paulwalker-arm wrote:

Perhaps "...,then we prefer to keep the diff check because they are cheaper."

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


More information about the cfe-commits mailing list