Skip to content

Commit e2c0990

Browse files
committed
Rename hasNoUsesExceptDebug to onlyHaveDebugUses. The double negation logic is
harder to understand. NFC.
1 parent d59d567 commit e2c0990

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

include/swift/SIL/DebugUtils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// some utility functions, which can be used instead of the relevant member
2727
// functions in ValueBase and SILValue:
2828
//
29-
// V->use_empty() -> hasNoUsesExceptDebug(V)
29+
// V->use_empty() -> onlyHaveDebugUses(V)
3030
// V.hasOneUse() -> hasOneNonDebugUse(V)
3131
// V.getUses() -> getNonDebugUses(V)
3232
// I->eraseFromParent() -> eraseFromParentWithDebugInsts(I)
@@ -137,7 +137,7 @@ inline iterator_range<NonDUIterator> getNonDebugUses(SILValue V) {
137137

138138
/// Returns true if a value (e.g. SILInstruction) has no uses except debug
139139
/// instructions.
140-
inline bool hasNoUsesExceptDebug(SILValue V) {
140+
inline bool onlyHaveDebugUses(SILValue V) {
141141
auto NonDebugUses = getNonDebugUses(V);
142142
return NonDebugUses.begin() == NonDebugUses.end();
143143
}

include/swift/SIL/SILValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class alignas(8) ValueBase : public SILAllocated<ValueBase> {
8585
void replaceAllUsesWith(ValueBase *RHS);
8686

8787
/// Returns true if this value has no uses.
88-
/// To ignore debug-info instructions use swift::hasNoUsesExceptDebug instead
88+
/// To ignore debug-info instructions use swift::onlyHaveDebugUses instead
8989
/// (see comment in DebugUtils.h).
9090
bool use_empty() const { return FirstUse == nullptr; }
9191

lib/SILOptimizer/SILCombiner/SILCombine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ SILInstruction *SILCombiner::eraseInstFromFunction(SILInstruction &I,
289289
bool AddOperandsToWorklist) {
290290
DEBUG(llvm::dbgs() << "SC: ERASE " << I << '\n');
291291

292-
assert(hasNoUsesExceptDebug(&I) && "Cannot erase instruction that is used!");
292+
assert(onlyHaveDebugUses(&I) && "Cannot erase instruction that is used!");
293293
// Make sure that we reprocess all operands now that we reduced their
294294
// use counts.
295295
if (I.getNumOperands() < 8 && AddOperandsToWorklist) {

lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static bool foldInverseReabstractionThunks(PartialApplyInst *PAI,
8787

8888
Combiner->replaceInstUsesWith(*PAI, PAI2->getArgument(0));
8989
Combiner->eraseInstFromFunction(*PAI);
90-
assert(hasNoUsesExceptDebug(PAI2) && "Should not have any uses");
90+
assert(onlyHaveDebugUses(PAI2) && "Should not have any uses");
9191
Combiner->eraseInstFromFunction(*PAI2);
9292

9393
return true;

lib/SILOptimizer/Transforms/ArrayCountPropagation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ bool ArrayAllocation::propagateCountToUsers() {
180180
HasChanged = true;
181181
}
182182

183-
if (HasChanged && hasNoUsesExceptDebug(Count))
183+
if (HasChanged && onlyHaveDebugUses(Count))
184184
DeadArrayCountCalls.push_back(Count);
185185
}
186186
return HasChanged;

lib/SILOptimizer/Transforms/SimplifyCFG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2459,7 +2459,7 @@ bool ArgumentSplitter::createNewArguments() {
24592459

24602460
// If we only had such users of Agg and Agg is dead now (ignoring debug
24612461
// instructions), remove it.
2462-
if (hasNoUsesExceptDebug(Agg))
2462+
if (onlyHaveDebugUses(Agg))
24632463
eraseFromParentWithDebugInsts(Agg);
24642464

24652465
return true;

lib/SILOptimizer/Utils/Local.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ swift::isInstructionTriviallyDead(SILInstruction *I) {
4141
I->getModule().getOptions().Optimization <= SILOptions::SILOptMode::None)
4242
return false;
4343

44-
if (!hasNoUsesExceptDebug(I) || isa<TermInst>(I))
44+
if (!onlyHaveDebugUses(I) || isa<TermInst>(I))
4545
return false;
4646

4747
if (auto *BI = dyn_cast<BuiltinInst>(I)) {

0 commit comments

Comments
 (0)