aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2022-03-19 19:59:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2022-03-23 19:57:26 +0000
commitc4cacdd447bae53964f439cb94acd9f5cc6a4c14 (patch)
tree0407e3f01143fe0f7324a3e3d3feea4fa80e6c07
parentad4277c7250cc8d26b6acdbc2efa21cfe97c9b51 (diff)
downloadsrc-c4cacdd447bae53964f439cb94acd9f5cc6a4c14.tar.gz
src-c4cacdd447bae53964f439cb94acd9f5cc6a4c14.zip
Apply llvm fix for assertion compiling certain versions of Wine
Merge commit b9ca73e1a8fd from llvm git (by Stephen Tozer): [DebugInfo] Correctly handle arrays with 0-width elements in GEP salvaging Fixes an issue where GEP salvaging did not properly account for GEP instructions which stepped over array elements of width 0 (effectively a no-op). This unnecessarily produced long expressions by appending `... + (x * 0)` and potentially extended the number of SSA values used in the dbg.value. This also erroneously triggered an assert in the salvage function that the element width would be strictly positive. These issues are resolved by simply ignoring these useless operands. Reviewed By: aprantl Differential Revision: https://reviews.llvm.org/D111809 PR: 262608 Reported by: Damjan Jovanovic <damjan.jov@gmail.com> MFC after: 3 days (cherry picked from commit 1b3bef43e3cb7fb0ab49b813839915514c1134cc)
-rw-r--r--contrib/llvm-project/llvm/lib/IR/Operator.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/llvm-project/llvm/lib/IR/Operator.cpp b/contrib/llvm-project/llvm/lib/IR/Operator.cpp
index 18a1c84933e0..f9dbed31c44c 100644
--- a/contrib/llvm-project/llvm/lib/IR/Operator.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/Operator.cpp
@@ -190,12 +190,14 @@ bool GEPOperator::collectOffset(
if (STy || ScalableType)
return false;
- // Insert an initial offset of 0 for V iff none exists already, then
- // increment the offset by IndexedSize.
- VariableOffsets.insert({V, APInt(BitWidth, 0)});
APInt IndexedSize =
APInt(BitWidth, DL.getTypeAllocSize(GTI.getIndexedType()));
- VariableOffsets[V] += IndexedSize;
+ // Insert an initial offset of 0 for V iff none exists already, then
+ // increment the offset by IndexedSize.
+ if (!IndexedSize.isZero()) {
+ VariableOffsets.insert({V, APInt(BitWidth, 0)});
+ VariableOffsets[V] += IndexedSize;
+ }
}
return true;
}