Skip to content

Commit cd6e1af

Browse files
authored
Merge pull request #37006 from gottesmm/pr-955048d8049271e67347326b8dfcc4da2fb6c45e
[inst-opt-utils] If InstModCallback::setUseValueFunc isn't set, just call RAUW directly rather than calling the default setUseValueFunc.
2 parents a7c24c5 + 8f76815 commit cd6e1af

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/swift/SILOptimizer/Utils/InstOptUtils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,13 @@ class InstModCallbacks {
413413
void replaceValueUsesWith(SILValue oldValue, SILValue newValue) {
414414
wereAnyCallbacksInvoked = true;
415415

416+
// If setUseValueFunc is not set, just call RAUW directly. RAUW in this case
417+
// is equivalent to what we do below. We just enable better
418+
// performance. This ensures that the default InstModCallback is really
419+
// fast.
420+
if (!setUseValueFunc)
421+
return oldValue->replaceAllUsesWith(newValue);
422+
416423
while (!oldValue->use_empty()) {
417424
auto *use = *oldValue->use_begin();
418425
setUseValue(use, newValue);

0 commit comments

Comments
 (0)