Skip to content

Commit 7a70049

Browse files
committed
Optimizer: remove the CopyForwarding pass
This pass removes `copy_addr` instructions. However, it has some problems which causes compiler crashes. It's not worth fixing these bugs because 1. Most copy_addrs can be eliminated by TempRValueElimination and TempLValueElimination. 2. Once we have opaque value we don't need copy_addr elimination, anyway. rdar://162212460
1 parent 4035c18 commit 7a70049

File tree

10 files changed

+1
-1997
lines changed

10 files changed

+1
-1997
lines changed

include/swift/SILOptimizer/PassManager/Passes.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ LEGACY_PASS(ConstantEvaluatorTester, "test-constant-evaluator",
254254
"Test constant evaluator")
255255
LEGACY_PASS(ConstantEvaluableSubsetChecker, "test-constant-evaluable-subset",
256256
"Test Swift code snippets expected to be constant evaluable")
257-
LEGACY_PASS(CopyForwarding, "copy-forwarding",
258-
"Copy Forwarding to Remove Redundant Copies")
259257
LEGACY_PASS(CopyPropagation, "copy-propagation",
260258
"Copy propagation to Remove Redundant SSA Copies, pruning debug info")
261259
LEGACY_PASS(MandatoryCopyPropagation, "mandatory-copy-propagation",

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,12 +459,6 @@ void addFunctionPasses(SILPassPipelinePlan &P,
459459
P.addDestroyAddrHoisting();
460460
}
461461

462-
// Propagate copies through stack locations. Should run after
463-
// box-to-stack promotion since it is limited to propagating through
464-
// stack locations. Should run before aggregate lowering since that
465-
// splits up copy_addr.
466-
P.addCopyForwarding();
467-
468462
// This DCE pass is the only DCE on ownership SIL. It can cleanup OSSA related
469463
// dead code, e.g. left behind by the ObjCBridgingOptimization.
470464
P.addDCE();

lib/SILOptimizer/Transforms/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ target_sources(swiftSILOptimizer PRIVATE
99
COWOpts.cpp
1010
CSE.cpp
1111
ConditionForwarding.cpp
12-
CopyForwarding.cpp
1312
CopyPropagation.cpp
1413
DeadCodeElimination.cpp
1514
DeadObjectElimination.cpp

0 commit comments

Comments
 (0)