diff options
author | Adrian Prantl <aprantl@apple.com> | 2017-11-13 21:24:54 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2017-11-13 21:24:54 +0000 |
commit | 73d0e94e8262de3848b5773328b0a9bd1e7a4892 (patch) | |
tree | a6d501b0852041357b2abac11dafa485c4f14aed /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 66b43dcab57fea54633d1af25925d17b6cbe78c8 (diff) | |
download | bcm5719-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.cpp | 27 |
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(); } |