summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2017-11-13 21:24:54 +0000
committerAdrian Prantl <aprantl@apple.com>2017-11-13 21:24:54 +0000
commit73d0e94e8262de3848b5773328b0a9bd1e7a4892 (patch)
treea6d501b0852041357b2abac11dafa485c4f14aed /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent66b43dcab57fea54633d1af25925d17b6cbe78c8 (diff)
downloadbcm5719-llvm-73d0e94e8262de3848b5773328b0a9bd1e7a4892.tar.gz
bcm5719-llvm-73d0e94e8262de3848b5773328b0a9bd1e7a4892.zip
Fix an assertion in SelectionDAG::transferDbgValues()
when transferring debug info describing the lower bits of an extended SDNode. rdar://problem/35504722 llvm-svn: 318086
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 1c4589ef14f..1ed982d6bac 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -7042,18 +7042,23 @@ void SelectionDAG::transferDbgValues(SDValue From, SDValue To,
auto *Expr = Dbg->getExpression();
// If a fragment is requested, update the expression.
if (SizeInBits) {
- auto Fragment = DIExpression::createFragmentExpression(
- Dbg->getExpression(), OffsetInBits, SizeInBits);
- if (Fragment)
- Expr = *Fragment;
- }
- // Clone the SbgValue unless the fragment creation failed.
- if (!SizeInBits || (SizeInBits && Expr)) {
- SDDbgValue *Clone =
- getDbgValue(Var, Expr, ToNode, To.getResNo(), Dbg->isIndirect(),
- Dbg->getDebugLoc(), Dbg->getOrder());
- ClonedDVs.push_back(Clone);
+ // When splitting a larger (e.g., sign-extended) value whose
+ // lower bits are described with an SDDbgValue, do not attempt
+ // to transfer the SDDbgValue to the upper bits.
+ if (auto FI = Expr->getFragmentInfo())
+ if (OffsetInBits + SizeInBits > FI->SizeInBits)
+ continue;
+ auto Fragment = DIExpression::createFragmentExpression(Expr, OffsetInBits,
+ SizeInBits);
+ if (!Fragment)
+ continue;
+ Expr = *Fragment;
}
+ // Clone the SDDbgValue and move it to To.
+ SDDbgValue *Clone =
+ getDbgValue(Var, Expr, ToNode, To.getResNo(), Dbg->isIndirect(),
+ Dbg->getDebugLoc(), Dbg->getOrder());
+ ClonedDVs.push_back(Clone);
Dbg->setIsInvalidated();
}
OpenPOWER on IntegriCloud