File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 24
24
#include " swift/SIL/SILUndef.h"
25
25
#include " swift/SIL/TerminatorUtils.h"
26
26
#include " swift/SIL/BasicBlockDatastructures.h"
27
+ #include " swift/SIL/OwnershipUtils.h"
27
28
#include " swift/SILOptimizer/PassManager/Passes.h"
28
29
#include " swift/SILOptimizer/PassManager/Transforms.h"
29
30
#include " swift/SILOptimizer/Utils/BasicBlockOptUtils.h"
@@ -190,7 +191,12 @@ static void propagateBasicBlockArgs(SILBasicBlock &BB) {
190
191
SILArgument *Arg = *AI;
191
192
192
193
// We were able to fold, so all users should use the new folded value.
193
- Arg->replaceAllUsesWith (Args[Idx]);
194
+ if (auto *bfi = getBorrowedFromUser (Arg)) {
195
+ bfi->replaceAllUsesWith (Args[Idx]);
196
+ bfi->eraseFromParent ();
197
+ } else {
198
+ Arg->replaceAllUsesWith (Args[Idx]);
199
+ }
194
200
++NumBasicBlockArgsPropagated;
195
201
}
196
202
Original file line number Diff line number Diff line change 1
- // RUN: %target-sil-opt -enable-sil-verify-all %s -diagnose-unreachable -sil-print-debuginfo | %FileCheck %s
1
+ // RUN: %target-sil-opt -enable-sil-verify-all %s -update-borrowed-from - diagnose-unreachable -sil-print-debuginfo | %FileCheck %s
2
2
3
3
import Builtin
4
4
import Swift
You can’t perform that action at this time.
0 commit comments