Skip to content

Commit ffd1f83

Browse files
authored
Revert "Properly transfer location info from debug_value into alloc_stack: we need to drop op_deref expression (#42245)"
This reverts commit c4ebb32.
1 parent f5078e2 commit ffd1f83

File tree

3 files changed

+5
-154
lines changed

3 files changed

+5
-154
lines changed

lib/SIL/Verifier/SILVerifier.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,9 +1315,9 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
13151315
case SILInstructionKind::DebugValueInst:
13161316
DebugVarTy = inst->getOperand(0)->getType();
13171317
if (DebugVarTy.isAddress()) {
1318-
// FIXME: op_deref could be applied to address types only.
1319-
// FIXME: Add this check
1320-
if (varInfo->DIExpr.startsWithDeref())
1318+
auto Expr = varInfo->DIExpr.operands();
1319+
if (!Expr.empty() &&
1320+
Expr.begin()->getOperator() == SILDIExprOperator::Dereference)
13211321
DebugVarTy = DebugVarTy.getObjectType();
13221322
}
13231323
break;
@@ -1343,16 +1343,9 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
13431343
require(DebugVars[argNum].first == varInfo->Name,
13441344
"Scope contains conflicting debug variables for one function "
13451345
"argument");
1346-
// The source variable might change its location (e.g. due to
1347-
// optimizations). Check for most common transformations (e.g. loading
1348-
// to SSA value and vice versa) as well
1349-
require(DebugVars[argNum].second == DebugVarTy ||
1350-
(DebugVars[argNum].second.isAddress() &&
1351-
DebugVars[argNum].second.getObjectType() == DebugVarTy) ||
1352-
(DebugVarTy.isAddress() &&
1353-
DebugVars[argNum].second == DebugVarTy.getObjectType()),
1346+
// Check for type
1347+
require(DebugVars[argNum].second == DebugVarTy,
13541348
"conflicting debug variable type!");
1355-
DebugVars[argNum].second = DebugVarTy;
13561349
} else {
13571350
// Reserve enough space.
13581351
while (DebugVars.size() <= argNum) {

lib/SILOptimizer/Differentiation/Common.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,6 @@ findDebugLocationAndVariable(SILValue originalValue) {
257257
for (auto *use : originalValue->getUses()) {
258258
if (auto *dvi = dyn_cast<DebugValueInst>(use->getUser()))
259259
return dvi->getVarInfo().map([&](SILDebugVariable var) {
260-
// We need to drop `op_deref` here as we're transferring debug info
261-
// location from debug_value instruction (which describes how to get value)
262-
// into alloc_stack (which describes the location)
263-
if (var.DIExpr.startsWithDeref())
264-
var.DIExpr.eraseElement(var.DIExpr.element_begin());
265260
return std::make_pair(dvi->getDebugLocation(), var);
266261
});
267262
}

test/AutoDiff/compiler_crashers_fixed/sr15849-invalid-debug-info.swift

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

0 commit comments

Comments
 (0)