Skip to content

Commit 4600aa7

Browse files
committed
[sil-inst-opt] Rename the internal madeChange bool in InstModCallback to wereAnyCallbacksInvoked.
This makes it clear that we are not talking about a madeChange in a general sense and are instead just tracking if /any/ of our callbacks were invoked. This is still useful enough for our users and will prevent confusion.
1 parent 2f6ffae commit 4600aa7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/swift/SILOptimizer/Utils/InstOptUtils.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ class InstModCallbacks {
336336
std::function<void(Operand *use, SILValue newValue)> setUseValueFunc;
337337

338338
/// A boolean that tracks if any of our callbacks were ever called.
339-
bool madeChange = false;
339+
bool wereAnyCallbacksInvoked = false;
340340

341341
public:
342342
InstModCallbacks(decltype(deleteInstFunc) deleteInstFunc)
@@ -363,27 +363,27 @@ class InstModCallbacks {
363363
InstModCallbacks(InstModCallbacks &&) = default;
364364

365365
void deleteInst(SILInstruction *instToDelete) {
366-
madeChange = true;
366+
wereAnyCallbacksInvoked = true;
367367
if (deleteInstFunc)
368368
return deleteInstFunc(instToDelete);
369369
instToDelete->eraseFromParent();
370370
}
371371

372372
void createdNewInst(SILInstruction *newlyCreatedInst) {
373-
madeChange = true;
373+
wereAnyCallbacksInvoked = true;
374374
if (createdNewInstFunc)
375375
createdNewInstFunc(newlyCreatedInst);
376376
}
377377

378378
void setUseValue(Operand *use, SILValue newValue) {
379-
madeChange = true;
379+
wereAnyCallbacksInvoked = true;
380380
if (setUseValueFunc)
381381
return setUseValueFunc(use, newValue);
382382
use->set(newValue);
383383
}
384384

385385
void replaceValueUsesWith(SILValue oldValue, SILValue newValue) {
386-
madeChange = true;
386+
wereAnyCallbacksInvoked = true;
387387

388388
while (!oldValue->use_empty()) {
389389
auto *use = *oldValue->use_begin();
@@ -393,12 +393,12 @@ class InstModCallbacks {
393393

394394
void eraseAndRAUWSingleValueInst(SingleValueInstruction *oldInst,
395395
SILValue newValue) {
396-
madeChange = true;
396+
wereAnyCallbacksInvoked = true;
397397
replaceValueUsesWith(oldInst, newValue);
398398
deleteInst(oldInst);
399399
}
400400

401-
bool getMadeChange() const { return madeChange; }
401+
bool hadCallbackInvocation() const { return wereAnyCallbacksInvoked; }
402402
};
403403

404404
/// Get all consumed arguments of a partial_apply.

0 commit comments

Comments
 (0)