Skip to content

Commit 7cf9145

Browse files
committed
Disable MandatoryCopyPropagation.
Mandatory copy propagation was primarily a stop-gap until lexcial lifetimes were implemented. It supposedly made variables lifetimes more consistent between -O and -Onone builds. Now that lexical lifetimes are enabled, it is no longer needed for that purpose (and will never satisfactorily meet that goal anyway). Mandatory copy propagation may be enabled again later as a -Onone " optimization. But that requires a more careful audit of the effect on debug information. For now, it should be disabled.
1 parent b3b8fa5 commit 7cf9145

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,7 @@ SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
912912
P.startPipeline("non-Diagnostic Enabling Mandatory Optimizations");
913913
P.addForEachLoopUnroll();
914914
P.addMandatoryCombine();
915-
if (P.getOptions().CopyPropagation == CopyPropagationOption::On) {
916-
// MandatoryCopyPropagation should only be run at -Onone, not -O.
917-
P.addMandatoryCopyPropagation();
918-
}
915+
919916
// TODO: MandatoryARCOpts should be subsumed by CopyPropagation. There should
920917
// be no need to run another analysis of copies at -Onone.
921918
P.addMandatoryARCOpts();

lib/SILOptimizer/Transforms/CopyPropagation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ void CopyPropagation::run() {
570570
}
571571
}
572572

573+
// MandatoryCopyPropagation is not currently enabled in the -Onone pipeline
574+
// because it may negatively affect the debugging experience.
573575
SILTransform *swift::createMandatoryCopyPropagation() {
574576
return new CopyPropagation(/*pruneDebug*/ true, /*canonicalizeAll*/ true,
575577
/*canonicalizeBorrows*/ false,
@@ -581,4 +583,3 @@ SILTransform *swift::createCopyPropagation() {
581583
/*canonicalizeBorrows*/ EnableRewriteBorrows,
582584
/*poisonRefs*/ false);
583585
}
584-

0 commit comments

Comments
 (0)