mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-04 10:04:33 +00:00
Cleanup TransferDbgValues
[DAG] Check debug values for invalidation before transferring and mark old debug values invalid when transferring to another SDValue. This fixes PR28613. Reviewers: jyknight, hans, dblaikie, echristo Subscribers: yaron.keren, ismail, llvm-commits Differential Revision: https://reviews.llvm.org/D22858 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277135 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e6abaac391
commit
5b7959028f
@ -6640,19 +6640,26 @@ void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) {
|
||||
SDNode *FromNode = From.getNode();
|
||||
SDNode *ToNode = To.getNode();
|
||||
ArrayRef<SDDbgValue *> DVs = GetDbgValues(FromNode);
|
||||
SmallVector<SDDbgValue *, 2> ClonedDVs;
|
||||
for (ArrayRef<SDDbgValue *>::iterator I = DVs.begin(), E = DVs.end();
|
||||
I != E; ++I) {
|
||||
SDDbgValue *Dbg = *I;
|
||||
// Only add Dbgvalues attached to same ResNo.
|
||||
if (Dbg->getKind() == SDDbgValue::SDNODE &&
|
||||
Dbg->getResNo() == From.getResNo()) {
|
||||
Dbg->getSDNode() == From.getNode() &&
|
||||
Dbg->getResNo() == From.getResNo() && !Dbg->isInvalidated()) {
|
||||
assert(FromNode != ToNode &&
|
||||
"Should not transfer Debug Values intranode");
|
||||
SDDbgValue *Clone =
|
||||
getDbgValue(Dbg->getVariable(), Dbg->getExpression(), ToNode,
|
||||
To.getResNo(), Dbg->isIndirect(), Dbg->getOffset(),
|
||||
Dbg->getDebugLoc(), Dbg->getOrder());
|
||||
AddDbgValue(Clone, ToNode, false);
|
||||
ClonedDVs.push_back(Clone);
|
||||
Dbg->setIsInvalidated();
|
||||
}
|
||||
}
|
||||
for (SDDbgValue *I : ClonedDVs)
|
||||
AddDbgValue(I, ToNode, false);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user