[llvm] r318455 - Revert "[SelectionDAG] Consolidate (t|T)ransferDbgValues methods, NFC."
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 13:08:51 PST 2017
Author: vedantk
Date: Thu Nov 16 13:08:51 2017
New Revision: 318455
URL: http://llvm.org/viewvc/llvm-project?rev=318455&view=rev
Log:
Revert "[SelectionDAG] Consolidate (t|T)ransferDbgValues methods, NFC."
This reverts commit r318448. It looks like some of the asserts need to
be weakened.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/16296
Modified:
llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=318455&r1=318454&r2=318455&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Nov 16 13:08:51 2017
@@ -1195,10 +1195,9 @@ public:
unsigned O);
/// Transfer debug values from one node to another, while optionally
- /// generating fragment expressions for split-up values. If \p InvalidateDbg
- /// is set, debug values are invalidated after they are transferred.
+ /// generating fragment expressions for split-up values.
void transferDbgValues(SDValue From, SDValue To, unsigned OffsetInBits = 0,
- unsigned SizeInBits = 0, bool InvalidateDbg = true);
+ unsigned SizeInBits = 0);
/// Remove the specified node from the system. If any of its
/// operands then becomes dead, remove them as well. Inform UpdateListener
@@ -1280,6 +1279,10 @@ public:
return DbgInfo->getSDDbgValues(SD);
}
+private:
+ /// Transfer SDDbgValues. Called via ReplaceAllUses{OfValue}?With
+ void TransferDbgValues(SDValue From, SDValue To);
+
public:
/// Return true if there are any SDDbgValue nodes associated
/// with this SelectionDAG.
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=318455&r1=318454&r2=318455&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Thu Nov 16 13:08:51 2017
@@ -845,14 +845,13 @@ void DAGTypeLegalizer::SetExpandedIntege
AnalyzeNewValue(Lo);
AnalyzeNewValue(Hi);
- // Transfer debug values. Don't invalidate the source debug value until it's
- // been transferred to the high and low bits.
+ // Transfer debug values.
if (DAG.getDataLayout().isBigEndian()) {
- DAG.transferDbgValues(Op, Hi, 0, Hi.getValueSizeInBits(), false);
+ DAG.transferDbgValues(Op, Hi, 0, Hi.getValueSizeInBits());
DAG.transferDbgValues(Op, Lo, Hi.getValueSizeInBits(),
Lo.getValueSizeInBits());
} else {
- DAG.transferDbgValues(Op, Lo, 0, Lo.getValueSizeInBits(), false);
+ DAG.transferDbgValues(Op, Lo, 0, Lo.getValueSizeInBits());
DAG.transferDbgValues(Op, Hi, Lo.getValueSizeInBits(),
Hi.getValueSizeInBits());
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=318455&r1=318454&r2=318455&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Nov 16 13:08:51 2017
@@ -7027,29 +7027,16 @@ SDDbgValue *SelectionDAG::getFrameIndexD
}
void SelectionDAG::transferDbgValues(SDValue From, SDValue To,
- unsigned OffsetInBits, unsigned SizeInBits,
- bool InvalidateDbg) {
+ unsigned OffsetInBits,
+ unsigned SizeInBits) {
SDNode *FromNode = From.getNode();
SDNode *ToNode = To.getNode();
- assert(FromNode && ToNode && "Can't modify dbg values");
-
- // Remove these checks when ReplaceAllUsesWith gets stricter.
- // TODO: assert(From != To && "Redundant dbg value transfer");
- // TODO: assert(FromNode != ToNode && "Intranode dbg value transfer");
- if (From == To || FromNode == ToNode)
- return;
-
- if (!FromNode->getHasDebugValue())
- return;
+ assert(FromNode != ToNode);
SmallVector<SDDbgValue *, 2> ClonedDVs;
for (SDDbgValue *Dbg : GetDbgValues(FromNode)) {
- // Just transfer the dbg value attached to From.
- if (Dbg->getResNo() != From.getResNo())
- continue;
-
- assert(!Dbg->isInvalidated() && "Invalid dbg value");
- assert(Dbg->getKind() == SDDbgValue::SDNODE && "Can't transfer dbg value");
+ if (Dbg->getKind() != SDDbgValue::SDNODE)
+ break;
DIVariable *Var = Dbg->getVariable();
auto *Expr = Dbg->getExpression();
@@ -7072,9 +7059,7 @@ void SelectionDAG::transferDbgValues(SDV
getDbgValue(Var, Expr, ToNode, To.getResNo(), Dbg->isIndirect(),
Dbg->getDebugLoc(), Dbg->getOrder());
ClonedDVs.push_back(Clone);
-
- if (InvalidateDbg)
- Dbg->setIsInvalidated();
+ Dbg->setIsInvalidated();
}
for (SDDbgValue *Dbg : ClonedDVs)
@@ -7152,7 +7137,7 @@ void SelectionDAG::ReplaceAllUsesWith(SD
assert(From != To.getNode() && "Cannot replace uses of with self");
// Preserve Debug Values
- transferDbgValues(FromN, To);
+ TransferDbgValues(FromN, To);
// Iterate over all the existing uses of From. New uses will be added
// to the beginning of the use list, which we avoid visiting.
@@ -7211,7 +7196,7 @@ void SelectionDAG::ReplaceAllUsesWith(SD
for (unsigned i = 0, e = From->getNumValues(); i != e; ++i)
if (From->hasAnyUseOfValue(i)) {
assert((i < To->getNumValues()) && "Invalid To location");
- transferDbgValues(SDValue(From, i), SDValue(To, i));
+ TransferDbgValues(SDValue(From, i), SDValue(To, i));
}
// Iterate over just the existing users of From. See the comments in
@@ -7255,7 +7240,7 @@ void SelectionDAG::ReplaceAllUsesWith(SD
// Preserve Debug Info.
for (unsigned i = 0, e = From->getNumValues(); i != e; ++i)
- transferDbgValues(SDValue(From, i), *To);
+ TransferDbgValues(SDValue(From, i), *To);
// Iterate over just the existing users of From. See the comments in
// the ReplaceAllUsesWith above.
@@ -7302,7 +7287,7 @@ void SelectionDAG::ReplaceAllUsesOfValue
}
// Preserve Debug Info.
- transferDbgValues(From, To);
+ TransferDbgValues(From, To);
// Iterate over just the existing users of From. See the comments in
// the ReplaceAllUsesWith above.
@@ -7380,7 +7365,7 @@ void SelectionDAG::ReplaceAllUsesOfValue
if (Num == 1)
return ReplaceAllUsesOfValueWith(*From, *To);
- transferDbgValues(*From, *To);
+ TransferDbgValues(*From, *To);
// Read up all the uses and make records of them. This helps
// processing new uses that are introduced during the
@@ -7529,6 +7514,31 @@ void SelectionDAG::AddDbgValue(SDDbgValu
DbgInfo->add(DB, SD, isParameter);
}
+/// Transfer SDDbgValues. Called in replace nodes.
+void SelectionDAG::TransferDbgValues(SDValue From, SDValue To) {
+ if (From == To || !From.getNode()->getHasDebugValue())
+ return;
+ SDNode *FromNode = From.getNode();
+ SDNode *ToNode = To.getNode();
+ SmallVector<SDDbgValue *, 2> ClonedDVs;
+ for (auto *Dbg : GetDbgValues(FromNode)) {
+ // Only add Dbgvalues attached to same ResNo.
+ if (Dbg->getKind() == SDDbgValue::SDNODE &&
+ 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->getDebugLoc(), Dbg->getOrder());
+ ClonedDVs.push_back(Clone);
+ Dbg->setIsInvalidated();
+ }
+ }
+ for (SDDbgValue *I : ClonedDVs)
+ AddDbgValue(I, ToNode, false);
+}
+
SDValue SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad,
SDValue NewMemOp) {
assert(isa<MemSDNode>(NewMemOp.getNode()) && "Expected a memop node");
More information about the llvm-commits
mailing list