Skip to content

Commit e6aec46

Browse files
committed
[ownership] Serialize/strip ownership at the beginning of the Onone pass pipeline so we strip ownership before use-prespecialized.
There shouldn't be any performance difference from doing this and it allows me to avoid updating parts of the generic specializer.
1 parent a2322b4 commit e6aec46

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -639,25 +639,24 @@ SILPassPipelinePlan
639639
SILPassPipelinePlan::getOnonePassPipeline(const SILOptions &Options) {
640640
SILPassPipelinePlan P(Options);
641641

642-
// First specialize user-code.
643-
P.startPipeline("Prespecialization");
644-
P.addUsePrespecialized();
642+
// First serialize the SIL if we are asked to.
643+
P.startPipeline("Serialization");
644+
P.addSerializeSILPass();
645+
646+
// And then strip ownership...
647+
if (!Options.StripOwnershipDuringDiagnosticsPipeline)
648+
P.addOwnershipModelEliminator();
645649

650+
// Finally perform some small transforms.
646651
P.startPipeline("Rest of Onone");
652+
P.addUsePrespecialized();
647653

648654
// Has only an effect if the -assume-single-thread option is specified.
649655
P.addAssumeSingleThreaded();
650656

651657
// Has only an effect if the -gsil option is specified.
652658
P.addSILDebugInfoGenerator();
653659

654-
// Finally serialize the SIL if we are asked to.
655-
P.addSerializeSILPass();
656-
657-
// And then strip ownership before we IRGen.
658-
if (!Options.StripOwnershipDuringDiagnosticsPipeline)
659-
P.addOwnershipModelEliminator();
660-
661660
return P;
662661
}
663662

test/sil-passpipeline-dump/basic.test-sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
// CHECK: [
55
// CHECK: [
6-
// CHECK: "Prespecialization",
7-
// CHECK-NEXT: ["UsePrespecialized","use-prespecialized"]
6+
// CHECK: "Serialization",
7+
// CHECK: ["SerializeSILPass","serialize-sil"]
88
// CHECK: ],
99
// CHECK: [
1010
// CHECK: "Rest of Onone",
11-
// CHECK-NEXT: ["AssumeSingleThreaded","sil-assume-single-threaded"],
12-
// CHECK-NEXT: ["SILDebugInfoGenerator","sil-debuginfo-gen"]
11+
// CHECK: ["UsePrespecialized","use-prespecialized"],
12+
// CHECK: ["AssumeSingleThreaded","sil-assume-single-threaded"],
13+
// CHECK: ["SILDebugInfoGenerator","sil-debuginfo-gen"]
1314
// CHECK: ]
14-
// CHECK: ]
15+
// CHECK: ]

0 commit comments

Comments
 (0)