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 2424#include " swift/SIL/SILUndef.h"
2525#include " swift/SIL/TerminatorUtils.h"
2626#include " swift/SIL/BasicBlockDatastructures.h"
27+ #include " swift/SIL/OwnershipUtils.h"
2728#include " swift/SILOptimizer/PassManager/Passes.h"
2829#include " swift/SILOptimizer/PassManager/Transforms.h"
2930#include " swift/SILOptimizer/Utils/BasicBlockOptUtils.h"
@@ -190,7 +191,12 @@ static void propagateBasicBlockArgs(SILBasicBlock &BB) {
190191 SILArgument *Arg = *AI;
191192
192193 // 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+ }
194200 ++NumBasicBlockArgsPropagated;
195201 }
196202
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
22
33import Builtin
44import Swift
You can’t perform that action at this time.
0 commit comments