Skip to content

Commit 91fe12a

Browse files
committed
[NFC] SIL: Typed debug_value.poisonRefs.
1 parent d76a8e6 commit 91fe12a

11 files changed

+39
-36
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,7 @@ class SILBuilder {
10721072

10731073
DebugValueInst *createDebugValue(
10741074
SILLocation Loc, SILValue src, SILDebugVariable Var,
1075-
bool poisonRefs = false,
1075+
PoisonRefs_t poisonRefs = DontPoisonRefs,
10761076
UsesMoveableValueDebugInfo_t wasMoved = DoesNotUseMoveableValueDebugInfo,
10771077
bool trace = false);
10781078
DebugValueInst *createDebugValueAddr(

include/swift/SIL/SILInstruction.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5402,11 +5402,11 @@ class DebugValueInst final
54025402
USE_SHARED_UINT8;
54035403

54045404
DebugValueInst(SILDebugLocation DebugLoc, SILValue Operand,
5405-
SILDebugVariable Var, bool poisonRefs,
5405+
SILDebugVariable Var, PoisonRefs_t poisonRefs,
54065406
UsesMoveableValueDebugInfo_t operandWasMoved, bool trace);
54075407
static DebugValueInst *create(SILDebugLocation DebugLoc, SILValue Operand,
54085408
SILModule &M, SILDebugVariable Var,
5409-
bool poisonRefs,
5409+
PoisonRefs_t poisonRefs,
54105410
UsesMoveableValueDebugInfo_t operandWasMoved,
54115411
bool trace);
54125412
static DebugValueInst *createAddr(SILDebugLocation DebugLoc, SILValue Operand,
@@ -5516,9 +5516,11 @@ class DebugValueInst final
55165516
/// OSSA lowering. It should not be necessary to model the poison operation as
55175517
/// a side effect, which would violate the rule that debug_values cannot
55185518
/// affect optimization.
5519-
bool poisonRefs() const { return sharedUInt8().DebugValueInst.poisonRefs; }
5519+
PoisonRefs_t poisonRefs() const {
5520+
return PoisonRefs_t(sharedUInt8().DebugValueInst.poisonRefs);
5521+
}
55205522

5521-
void setPoisonRefs(bool poisonRefs = true) {
5523+
void setPoisonRefs(PoisonRefs_t poisonRefs = PoisonRefs) {
55225524
sharedUInt8().DebugValueInst.poisonRefs = poisonRefs;
55235525
}
55245526

lib/SIL/IR/SILBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ void SILBuilder::emitDestructureValueOperation(
635635

636636
DebugValueInst *SILBuilder::createDebugValue(SILLocation Loc, SILValue src,
637637
SILDebugVariable Var,
638-
bool poisonRefs,
638+
PoisonRefs_t poisonRefs,
639639
UsesMoveableValueDebugInfo_t moved,
640640
bool trace) {
641641
if (shouldDropVariable(Var, Loc))

lib/SIL/IR/SILInstructions.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,8 +436,8 @@ SILType AllocBoxInst::getAddressType() const {
436436

437437
DebugValueInst::DebugValueInst(
438438
SILDebugLocation DebugLoc, SILValue Operand, SILDebugVariable Var,
439-
bool poisonRefs, UsesMoveableValueDebugInfo_t usesMoveableValueDebugInfo,
440-
bool trace)
439+
PoisonRefs_t poisonRefs,
440+
UsesMoveableValueDebugInfo_t usesMoveableValueDebugInfo, bool trace)
441441
: UnaryInstructionBase(DebugLoc, Operand),
442442
SILDebugVariableSupplement(Var.DIExpr.getNumElements(),
443443
Var.Type.has_value(), Var.Loc.has_value(),
@@ -454,7 +454,8 @@ DebugValueInst::DebugValueInst(
454454

455455
DebugValueInst *DebugValueInst::create(SILDebugLocation DebugLoc,
456456
SILValue Operand, SILModule &M,
457-
SILDebugVariable Var, bool poisonRefs,
457+
SILDebugVariable Var,
458+
PoisonRefs_t poisonRefs,
458459
UsesMoveableValueDebugInfo_t wasMoved,
459460
bool trace) {
460461
// Don't store the same information twice.
@@ -478,8 +479,8 @@ DebugValueInst::createAddr(SILDebugLocation DebugLoc, SILValue Operand,
478479
if (!isa<AllocStackInst>(Operand))
479480
Var.DIExpr.prependElements(
480481
{SILDIExprElement::createOperator(SILDIExprOperator::Dereference)});
481-
return DebugValueInst::create(DebugLoc, Operand, M, Var,
482-
/*poisonRefs=*/false, wasMoved, trace);
482+
return DebugValueInst::create(DebugLoc, Operand, M, Var, DontPoisonRefs,
483+
wasMoved, trace);
483484
}
484485

485486
bool DebugValueInst::exprStartsWithDeref() const {

lib/SIL/Parser/ParseSIL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3391,7 +3391,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
33913391
}
33923392

33933393
case SILInstructionKind::DebugValueInst: {
3394-
bool poisonRefs = false;
3394+
PoisonRefs_t poisonRefs = DontPoisonRefs;
33953395
bool hasTrace = false;
33963396
UsesMoveableValueDebugInfo_t usesMoveableValueDebugInfo =
33973397
DoesNotUseMoveableValueDebugInfo;
@@ -3402,7 +3402,7 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
34023402
SourceLoc attributeLoc;
34033403
while (parseSILOptional(attributeName, attributeLoc, *this)) {
34043404
if (attributeName == "poison")
3405-
poisonRefs = true;
3405+
poisonRefs = PoisonRefs;
34063406
else if (attributeName == "trace")
34073407
hasTrace = true;
34083408
else if (attributeName == "moveable_value_debuginfo")

lib/SILOptimizer/Mandatory/ConsumeOperatorCopyableAddressesChecker.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,7 @@ bool DataflowState::cleanupAllDestroyAddr(
15291529
addressDebugInst->getDebugScope());
15301530
dbgValueInsertBuilder.createDebugValue(
15311531
(*addressDebugInst)->getLoc(), SILUndef::get(address), *varInfo,
1532-
false, UsesMoveableValueDebugInfo);
1532+
DontPoisonRefs, UsesMoveableValueDebugInfo);
15331533
}
15341534
}
15351535
useState.destroys.insert(dvi);
@@ -1569,7 +1569,7 @@ bool DataflowState::cleanupAllDestroyAddr(
15691569
SILBuilderWithScope reinitBuilder((*reinit)->getNextInstruction());
15701570
reinitBuilder.setCurrentDebugScope(addressDebugInst->getDebugScope());
15711571
reinitBuilder.createDebugValue((*addressDebugInst)->getLoc(), address,
1572-
*varInfo, false,
1572+
*varInfo, DontPoisonRefs,
15731573
UsesMoveableValueDebugInfo);
15741574
}
15751575
}
@@ -1821,7 +1821,7 @@ bool DataflowState::process(
18211821
undefBuilder.setCurrentDebugScope(addressDebugInst->getDebugScope());
18221822
undefBuilder.createDebugValue(
18231823
addressDebugInst->getLoc(), SILUndef::get(address), *varInfo,
1824-
false /*poison*/, UsesMoveableValueDebugInfo);
1824+
DontPoisonRefs, UsesMoveableValueDebugInfo);
18251825
}
18261826
}
18271827

@@ -2202,9 +2202,9 @@ bool ConsumeOperatorCopyableAddressesChecker::performSingleBasicBlockAnalysis(
22022202
if (auto varInfo = addressDebugInst.getVarInfo()) {
22032203
SILBuilderWithScope undefBuilder(builder);
22042204
undefBuilder.setCurrentDebugScope(addressDebugInst->getDebugScope());
2205-
undefBuilder.createDebugValue(addressDebugInst->getLoc(),
2206-
SILUndef::get(address), *varInfo, false,
2207-
UsesMoveableValueDebugInfo);
2205+
undefBuilder.createDebugValue(
2206+
addressDebugInst->getLoc(), SILUndef::get(address), *varInfo,
2207+
DontPoisonRefs, UsesMoveableValueDebugInfo);
22082208
}
22092209
addressDebugInst.markAsMoved();
22102210
}
@@ -2319,9 +2319,9 @@ bool ConsumeOperatorCopyableAddressesChecker::performSingleBasicBlockAnalysis(
23192319
{
23202320
SILBuilderWithScope undefBuilder(builder);
23212321
undefBuilder.setCurrentDebugScope(addressDebugInst->getDebugScope());
2322-
undefBuilder.createDebugValue(addressDebugInst->getLoc(),
2323-
SILUndef::get(address), *varInfo, false,
2324-
UsesMoveableValueDebugInfo);
2322+
undefBuilder.createDebugValue(
2323+
addressDebugInst->getLoc(), SILUndef::get(address), *varInfo,
2324+
DontPoisonRefs, UsesMoveableValueDebugInfo);
23252325
}
23262326
{
23272327
// Make sure at the reinit point to create a new debug value after the
@@ -2330,7 +2330,7 @@ bool ConsumeOperatorCopyableAddressesChecker::performSingleBasicBlockAnalysis(
23302330
SILBuilderWithScope reinitBuilder(next);
23312331
reinitBuilder.setCurrentDebugScope(addressDebugInst->getDebugScope());
23322332
reinitBuilder.createDebugValue(addressDebugInst->getLoc(), address,
2333-
*varInfo, false,
2333+
*varInfo, DontPoisonRefs,
23342334
UsesMoveableValueDebugInfo);
23352335
}
23362336
}
@@ -2369,9 +2369,9 @@ bool ConsumeOperatorCopyableAddressesChecker::performSingleBasicBlockAnalysis(
23692369
if (auto varInfo = addressDebugInst.getVarInfo()) {
23702370
SILBuilderWithScope undefBuilder(builder);
23712371
undefBuilder.setCurrentDebugScope(addressDebugInst->getDebugScope());
2372-
undefBuilder.createDebugValue(addressDebugInst->getLoc(),
2373-
SILUndef::get(address), *varInfo, false,
2374-
UsesMoveableValueDebugInfo);
2372+
undefBuilder.createDebugValue(
2373+
addressDebugInst->getLoc(), SILUndef::get(address), *varInfo,
2374+
DontPoisonRefs, UsesMoveableValueDebugInfo);
23752375
}
23762376
addressDebugInst.markAsMoved();
23772377
}

lib/SILOptimizer/Mandatory/ConsumeOperatorCopyableValuesChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ bool ConsumeOperatorCopyableValuesChecker::check() {
512512
builder.setCurrentDebugScope(dbgVarInst->getDebugScope());
513513
builder.createDebugValue(
514514
dbgVarInst->getLoc(), SILUndef::get(mvi->getOperand()),
515-
*varInfo, false /*poison*/, UsesMoveableValueDebugInfo);
515+
*varInfo, DontPoisonRefs, UsesMoveableValueDebugInfo);
516516
}
517517
validMoves.push_back(mvi);
518518
}

lib/SILOptimizer/Mandatory/DebugInfoCanonicalizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static SILInstruction *cloneDebugValue(DebugVarCarryingInst original,
7575
builder.setCurrentDebugScope(original->getDebugScope());
7676
return builder.createDebugValue(
7777
original->getLoc(), original.getOperandForDebugValueClone(),
78-
*original.getVarInfo(), false, UsesMoveableValueDebugInfo);
78+
*original.getVarInfo(), DontPoisonRefs, UsesMoveableValueDebugInfo);
7979
}
8080

8181
static SILInstruction *cloneDebugValue(DebugVarCarryingInst original,
@@ -84,7 +84,7 @@ static SILInstruction *cloneDebugValue(DebugVarCarryingInst original,
8484
builder.setCurrentDebugScope(original->getDebugScope());
8585
return builder.createDebugValue(
8686
original->getLoc(), original.getOperandForDebugValueClone(),
87-
*original.getVarInfo(), false, UsesMoveableValueDebugInfo);
87+
*original.getVarInfo(), DontPoisonRefs, UsesMoveableValueDebugInfo);
8888
}
8989

9090
//===----------------------------------------------------------------------===//

lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ static void insertDebugValueBefore(SILInstruction *insertPt,
323323
SILBuilderWithScope debugInfoBuilder(insertPt);
324324
debugInfoBuilder.setCurrentDebugScope(debugVar->getDebugScope());
325325
debugInfoBuilder.createDebugValue(debugVar->getLoc(), operand(), *varInfo,
326-
false, UsesMoveableValueDebugInfo);
326+
DontPoisonRefs, UsesMoveableValueDebugInfo);
327327
}
328328

329329
static void convertMemoryReinitToInitForm(SILInstruction *memInst,

lib/SILOptimizer/Mandatory/MovedAsyncVarDebugInfoPropagator.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ cloneDebugValueMakeUndef(DebugVarCarryingInst original, SILBasicBlock *block) {
9696
builder.setCurrentDebugScope(original->getDebugScope());
9797
auto *undef = SILUndef::get(original.getOperandForDebugValueClone());
9898
return builder.createDebugValue(original->getLoc(), undef,
99-
*original.getVarInfo(), false,
99+
*original.getVarInfo(), DontPoisonRefs,
100100
UsesMoveableValueDebugInfo);
101101
}
102102

@@ -107,7 +107,7 @@ cloneDebugValueMakeUndef(DebugVarCarryingInst original,
107107
builder.setCurrentDebugScope(original->getDebugScope());
108108
auto *undef = SILUndef::get(original.getOperandForDebugValueClone());
109109
return builder.createDebugValue(original->getLoc(), undef,
110-
*original.getVarInfo(), false,
110+
*original.getVarInfo(), DontPoisonRefs,
111111
UsesMoveableValueDebugInfo);
112112
}
113113

@@ -120,7 +120,7 @@ static SILInstruction *cloneDebugValue(DebugVarCarryingInst original,
120120
builder.setCurrentDebugScope(original->getDebugScope());
121121
return builder.createDebugValue(
122122
original->getLoc(), original.getOperandForDebugValueClone(),
123-
*original.getVarInfo(), false, UsesMoveableValueDebugInfo);
123+
*original.getVarInfo(), DontPoisonRefs, UsesMoveableValueDebugInfo);
124124
}
125125

126126
static SILInstruction *cloneDebugValue(DebugVarCarryingInst original,
@@ -132,7 +132,7 @@ static SILInstruction *cloneDebugValue(DebugVarCarryingInst original,
132132
builder.setCurrentDebugScope(original->getDebugScope());
133133
return builder.createDebugValue(
134134
original->getLoc(), original.getOperandForDebugValueClone(),
135-
*original.getVarInfo(), false, UsesMoveableValueDebugInfo);
135+
*original.getVarInfo(), DontPoisonRefs, UsesMoveableValueDebugInfo);
136136
}
137137

138138
namespace {

0 commit comments

Comments
 (0)