[llvm] 040c60d - Fix a miscompile introduced by 99203f2.
Richard Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 25 16:54:16 PDT 2021
Author: Richard Smith
Date: 2021-03-25T16:53:58-07:00
New Revision: 040c60d9b69e2ad570556f255a746929a4b10e82
URL: https://github.com/llvm/llvm-project/commit/040c60d9b69e2ad570556f255a746929a4b10e82
DIFF: https://github.com/llvm/llvm-project/commit/040c60d9b69e2ad570556f255a746929a4b10e82.diff
LOG: 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.
Added:
Modified:
llvm/lib/Analysis/LoopAccessAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 56ac3051af15..2a6987848ca5 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;
More information about the llvm-commits
mailing list