[PATCH] D98967: [Analysis]Add getPointersDiff function to improve compile time.

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 05:53:27 PDT 2021


uabelho added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3155
         }
-        const SCEV *Scev0 = SE->getSCEV(Ptr0);
-        const SCEV *ScevN = SE->getSCEV(PtrN);
-        const auto *Diff =
-            dyn_cast<SCEVConstant>(SE->getMinusSCEV(ScevN, Scev0));
-        uint64_t Size = DL->getTypeAllocSize(ScalarTy);
+        Optional<int> Dist = getPointersDiff(Ptr0, PtrN, *DL, *SE);
         // Check that the sorted pointer operands are consecutive.
----------------
Hi,
I'm seeing a miscompile with this patch for my out-of-tree target and I wonder if we perhaps should pass StrictCheck=true for this getPointerDiff call.

In the case I see I have two loads where Dist is calculated as 1, but actually it's 3/2, and the resulting vectorized load then doesn't load the correct words.

I'm having some troubles reproducing this on an in-tree target but I don't see why it shouldn't be possible.

I see that if I do pass StrictCheck=true here the miscopile goes away.

@ABataev , what do you think about this? Is it possible that the code broke here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98967/new/

https://reviews.llvm.org/D98967



More information about the llvm-commits mailing list