Optimizer: replace PredictableMemoryAccessOptimizations with MandatoryRedundantLoadElimination in the pass pipeline

PredictableMemoryAccessOptimizations has become unmaintainable as-is.
RedundantLoadElimination does (almost) the same thing as PredictableMemoryAccessOptimizations.
It's not as powerful but good enough because PredictableMemoryAccessOptimizations is actually only needed for promoting integer values for mandatory constant propagation.
And most importantly: RedundantLoadElimination does not insert additional copies which was a big problem in PredictableMemoryAccessOptimizations.

Fixes rdar://142814676
This commit is contained in:
Erik Eckstein
2025-02-06 15:28:53 +01:00
parent ce73deebc4
commit ba4081ee76
30 changed files with 191 additions and 406 deletions

View File

@@ -16,12 +16,10 @@ public class M {
// Verify that definite initialization doesn't create a bogus description of
// self pointing to the liveness bitvector.
// CHECK: sil @$s4main1MC4fromAcA12WithDelegate_p_tKcfc
// CHECK: bb0
// CHECK-NEXT: %2 = alloc_stack $Builtin.Int2
// CHECK-NOT: let
// CHECK-NOT: name
// CHECK: scope
// CHECK-LABEL: sil @$s4main1MC4fromAcA12WithDelegate_p_tKcfc
// CHECK: bb0
// CHECK-NOT: alloc_stack $Builtin.Int2{{.*}}let
// CHECK: } // end sil function '$s4main1MC4fromAcA12WithDelegate_p_tKcfc'
public init(from d: WithDelegate) throws {
guard let delegate = d.delegate as? DelegateB
else { throw Err.s(0) }