File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,12 @@ llvm::cl::opt<bool> DisableConvertEscapeToNoEscapeSwitchEnumPeephole(
4141 " Disable the convert_escape_to_noescape switch enum peephole. " ),
4242 llvm::cl::Hidden);
4343
44+ llvm::cl::opt<bool > DisableCopyEliminationOfCopyableCapture (
45+ " sil-disable-copy-elimination-of-copyable-closure-capture" ,
46+ llvm::cl::init (false ),
47+ llvm::cl::desc(" Don't eliminate copy_addr of Copyable closure captures "
48+ " inserted by SILGen" ));
49+
4450using namespace swift ;
4551
4652// / Given an optional diamond, return the bottom of the diamond.
@@ -761,6 +767,13 @@ static SILValue tryRewriteToPartialApplyStack(
761767 continue ;
762768 }
763769
770+ if (DisableCopyEliminationOfCopyableCapture) {
771+ if (!copy->getType ().isMoveOnly ()) {
772+ LLVM_DEBUG (llvm::dbgs () << " -- not move-only\n " );
773+ continue ;
774+ }
775+ }
776+
764777 // Is the capture a borrow?
765778
766779 auto paramIndex = i + appliedArgStartIdx;
Original file line number Diff line number Diff line change 1- // RUN: %target-sil-opt -enable-sil-verify-all -closure-lifetime-fixup -emit-verbose-sil %s | %FileCheck %s
1+ // RUN: %target-sil-opt -enable-sil-verify-all -closure-lifetime-fixup -emit-verbose-sil -sil-disable-copy-elimination-of-copyable-closure-capture=true %s | %FileCheck %s
22
33import Builtin
44import Swift
You can’t perform that action at this time.
0 commit comments