Skip to content

Commit 1b58917

Browse files
committed
Revert "[DebugInfo] Correctly track SDNode dependencies for list debug values"
Reverted due to failure on the sanitizer-x86_64-linux-fast bot. This reverts commit e10493e.
1 parent a345419 commit 1b58917

File tree

4 files changed

+15
-210
lines changed

4 files changed

+15
-210
lines changed

llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ class SDDbgValue {
138138

139139
private:
140140
LocOpVector LocationOps;
141-
// SDNode dependencies will be calculated as SDNodes that appear in
142-
// LocationOps plus these AdditionalDependencies.
143-
SDNodeVector AdditionalDependencies;
141+
SDNodeVector SDNodes;
144142
DIVariable *Var;
145143
DIExpression *Expr;
146144
DebugLoc DL;
@@ -155,9 +153,8 @@ class SDDbgValue {
155153
ArrayRef<SDNode *> Dependencies, bool IsIndirect, DebugLoc DL,
156154
unsigned O, bool IsVariadic)
157155
: LocationOps(L.begin(), L.end()),
158-
AdditionalDependencies(Dependencies.begin(), Dependencies.end()),
159-
Var(Var), Expr(Expr), DL(DL), Order(O), IsIndirect(IsIndirect),
160-
IsVariadic(IsVariadic) {
156+
SDNodes(Dependencies.begin(), Dependencies.end()), Var(Var), Expr(Expr),
157+
DL(DL), Order(O), IsIndirect(IsIndirect), IsVariadic(IsVariadic) {
161158
assert(IsVariadic || L.size() == 1);
162159
assert(!(IsVariadic && IsIndirect));
163160
}
@@ -173,18 +170,9 @@ class SDDbgValue {
173170
LocOpVector copyLocationOps() const { return LocationOps; }
174171

175172
// Returns the SDNodes which this SDDbgValue depends on.
176-
SDNodeVector getSDNodes() const {
177-
SDNodeVector Dependencies;
178-
for (SDDbgOperand DbgOp : LocationOps)
179-
if (DbgOp.getKind() == SDDbgOperand::SDNODE)
180-
Dependencies.push_back(DbgOp.getSDNode());
181-
Dependencies.append(AdditionalDependencies);
182-
return Dependencies;
183-
}
173+
ArrayRef<SDNode *> getSDNodes() const { return SDNodes; }
184174

185-
ArrayRef<SDNode *> getAdditionalDependencies() const {
186-
return AdditionalDependencies;
187-
}
175+
SDNodeVector copySDNodes() const { return SDNodes; }
188176

189177
/// Returns whether this is an indirect value.
190178
bool isIndirect() const { return IsIndirect; }

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8583,7 +8583,7 @@ SDDbgValue *SelectionDAG::getDbgValue(DIVariable *Var, DIExpression *Expr,
85838583
assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
85848584
"Expected inlined-at fields to agree");
85858585
return new (DbgInfo->getAlloc())
8586-
SDDbgValue(Var, Expr, SDDbgOperand::fromNode(N, R), {}, IsIndirect, DL, O,
8586+
SDDbgValue(Var, Expr, SDDbgOperand::fromNode(N, R), N, IsIndirect, DL, O,
85878587
/*IsVariadic=*/false);
85888588
}
85898589

@@ -8707,10 +8707,12 @@ void SelectionDAG::transferDbgValues(SDValue From, SDValue To,
87078707
Expr = *Fragment;
87088708
}
87098709

8710-
auto AdditionalDependencies = Dbg->getAdditionalDependencies();
8710+
auto NewDependencies = Dbg->copySDNodes();
8711+
std::replace(NewDependencies.begin(), NewDependencies.end(), FromNode,
8712+
ToNode);
87118713
// Clone the SDDbgValue and move it to To.
87128714
SDDbgValue *Clone = getDbgValueList(
8713-
Var, Expr, NewLocOps, AdditionalDependencies, Dbg->isIndirect(),
8715+
Var, Expr, NewLocOps, NewDependencies, Dbg->isIndirect(),
87148716
Dbg->getDebugLoc(), std::max(ToNode->getIROrder(), Dbg->getOrder()),
87158717
Dbg->isVariadic());
87168718
ClonedDVs.push_back(Clone);
@@ -8770,9 +8772,11 @@ void SelectionDAG::salvageDebugInfo(SDNode &N) {
87708772
(void)Changed;
87718773
assert(Changed && "Salvage target doesn't use N");
87728774

8773-
auto AdditionalDependencies = DV->getAdditionalDependencies();
8775+
auto NewDependencies = DV->copySDNodes();
8776+
std::replace(NewDependencies.begin(), NewDependencies.end(), &N,
8777+
N0.getNode());
87748778
SDDbgValue *Clone = getDbgValueList(DV->getVariable(), DIExpr,
8775-
NewLocOps, AdditionalDependencies,
8779+
NewLocOps, NewDependencies,
87768780
DV->isIndirect(), DV->getDebugLoc(),
87778781
DV->getOrder(), DV->isVariadic());
87788782
ClonedDVs.push_back(Clone);

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,7 @@ bool SelectionDAGBuilder::handleDebugValue(ArrayRef<const Value *> Values,
13311331
// Only emit func arg dbg value for non-variadic dbg.values for now.
13321332
if (!IsVariadic && EmitFuncArgumentDbgValue(V, Var, Expr, dl, false, N))
13331333
return true;
1334+
Dependencies.push_back(N.getNode());
13341335
if (auto *FISDN = dyn_cast<FrameIndexSDNode>(N.getNode())) {
13351336
// Construct a FrameIndexDbgValue for FrameIndexSDNodes so we can
13361337
// describe stack slot locations.
@@ -1342,7 +1343,6 @@ bool SelectionDAGBuilder::handleDebugValue(ArrayRef<const Value *> Values,
13421343
// dbg.value(i32* %px, !"int x", !DIExpression(DW_OP_deref))
13431344
//
13441345
// Both describe the direct values of their associated variables.
1345-
Dependencies.push_back(N.getNode());
13461346
LocationOps.emplace_back(SDDbgOperand::fromFrameIdx(FISDN->getIndex()));
13471347
continue;
13481348
}

llvm/test/CodeGen/X86/dbg-list-dependencies.ll

Lines changed: 0 additions & 187 deletions
This file was deleted.

0 commit comments

Comments
 (0)