Skip to content

Commit e0fda80

Browse files
authored
Merge pull request #71538 from atrick/fix-consuming
Lower move-only wrapper types earlier to disable the TrivialMoveOnlyTypeEliminator pass.
2 parents fab7ff0 + 3caf508 commit e0fda80

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,22 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
183183
if (EnableDeinitDevirtualizer)
184184
P.addDeinitDevirtualizer();
185185

186+
// FIXME: rdar://122701694 (`consuming` keyword causes verification error on
187+
// invalid SIL types)
188+
//
186189
// Lower move only wrapped trivial types.
187-
P.addTrivialMoveOnlyTypeEliminator();
190+
// P.addTrivialMoveOnlyTypeEliminator();
191+
188192
// Check no uses after consume operator of a value in an address.
189193
P.addConsumeOperatorCopyableAddressesChecker();
190194
// No uses after consume operator of copyable value.
191195
P.addConsumeOperatorCopyableValuesChecker();
192196

197+
// As a temporary measure, we also eliminate move only for non-trivial types
198+
// until we can audit the later part of the pipeline. Eventually, this should
199+
// occur before IRGen.
200+
P.addMoveOnlyTypeEliminator();
201+
193202
//
194203
// End Ownership Optimizations
195204
//===---
@@ -255,11 +264,6 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
255264
// Canonical swift requires all non cond_br critical edges to be split.
256265
P.addSplitNonCondBrCriticalEdges();
257266

258-
// As a temporary measure, we also eliminate move only for non-trivial types
259-
// until we can audit the later part of the pipeline. Eventually, this should
260-
// occur before IRGen.
261-
P.addMoveOnlyTypeEliminator();
262-
263267
// For embedded Swift: Specialize generic class vtables.
264268
P.addVTableSpecializer();
265269

test/SILOptimizer/noimplicitcopy_consuming_parameters.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class Klass {
99

1010
public struct NonTrivialStruct {
1111
var k = Klass()
12+
let i = 0
1213

1314
func doSomethingDefault() {}
1415
borrowing func doSomethingBorrowing() {}
@@ -230,6 +231,10 @@ func testLoadableConsumingCopyOperator(_ x: consuming NonTrivialStruct) {
230231
_ = copy x
231232
}
232233

234+
func testLoadableConsumingTrivialLetField(_ x: consuming NonTrivialStruct) -> Int {
235+
return x.i
236+
}
237+
233238
//////////////////////////////////////////
234239
// MARK: Trivial Struct Consuming Tests //
235240
//////////////////////////////////////////

0 commit comments

Comments
 (0)