diff options
author | Richard Smith <richard@metafoo.co.uk> | 2021-03-25 16:51:56 -0700 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2021-03-25 16:53:58 -0700 |
commit | 040c60d9b69e2ad570556f255a746929a4b10e82 (patch) | |
tree | 4a7211c516b6c4ca0478dad320dd35de10d18aeb /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | cf62b6d3b223a1125576eb24c3c14c7d587941d1 (diff) | |
download | llvm-040c60d9b69e2ad570556f255a746929a4b10e82.zip llvm-040c60d9b69e2ad570556f255a746929a4b10e82.tar.gz llvm-040c60d9b69e2ad570556f255a746929a4b10e82.tar.bz2 |
Fix a miscompile introduced by 99203f2.
getPointersDiff would previously round down the difference between two
pointers to a multiple of the element size of the pointee, which could
result in a pointer value being decreased a little.
Alexey Bataev has graciously agreed to add a testcase for this;
submitting the bugfix now to unblock.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 56ac305..2a69878 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -1204,7 +1204,8 @@ bool llvm::sortPtrAccesses(ArrayRef<Value *> VL, const DataLayout &DL, int Cnt = 1; bool IsConsecutive = true; for (auto *Ptr : VL.drop_front()) { - Optional<int> Diff = getPointersDiff(Ptr0, Ptr, DL, SE); + Optional<int> Diff = + getPointersDiff(Ptr0, Ptr, DL, SE, /*StrictCheck=*/true); if (!Diff) return false; |