Skip to content

Commit a89955b

Browse files
authored
Merge pull request #40201 from gottesmm/pr-37acc70949f783d302c5ba7e99f6fbe5fb7baaed
[move-operator] Start having SILGen emit lexical lifetimes and teach the optimizer how to maintain lexical lifetimes until the lexical lifetime elimination.
2 parents e78abc2 + 7851530 commit a89955b

File tree

63 files changed

+229
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+229
-191
lines changed

include/swift/AST/SILOptions.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ enum class LexicalLifetimesOption : uint8_t {
3434
// Do not insert any lexical lifetimes.
3535
Off = 0,
3636

37+
// Insert lexical lifetimes in SILGen, but remove them before leaving Raw SIL.
38+
Early,
39+
3740
// Insert lexical lifetimes and do not remove them until OSSA is lowered. This
3841
// is experimental.
3942
ExperimentalLate,
@@ -56,7 +59,7 @@ class SILOptions {
5659
bool RemoveRuntimeAsserts = false;
5760

5861
/// Enable experimental support for emitting defined borrow scopes.
59-
LexicalLifetimesOption LexicalLifetimes = LexicalLifetimesOption::Off;
62+
LexicalLifetimesOption LexicalLifetimes = LexicalLifetimesOption::Early;
6063

6164
/// Force-run SIL copy propagation to shorten object lifetime in whatever
6265
/// optimization pipeline is currently used.

include/swift/SIL/SILModule.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,8 @@ inline bool SILOptions::supportsLexicalLifetimes(const SILModule &mod) const {
912912
switch (mod.getStage()) {
913913
case SILStage::Raw:
914914
// In Raw SIL, we support lexical lifetimes as long as lexical lifetimes is
915-
// not turned off all the way.
915+
// not turned off all the way. This means lexical lifetimes is set to either
916+
// early or experimental late.
916917
return LexicalLifetimes != LexicalLifetimesOption::Off;
917918
case SILStage::Canonical:
918919
// In Canonical SIL, we only support lexical lifetimes when in experimental

lib/SILGen/SILGenDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,12 +1760,15 @@ void SILGenFunction::destroyLocalVariable(SILLocation silLoc, VarDecl *vd) {
17601760
return;
17611761
}
17621762

1763-
if (!getASTContext().SILOpts.supportsLexicalLifetimes(getModule()) ||
1764-
Val->getOwnershipKind() == OwnershipKind::None) {
1763+
if (!getASTContext().SILOpts.supportsLexicalLifetimes(getModule())) {
17651764
B.emitDestroyValueOperation(silLoc, Val);
17661765
return;
17671766
}
17681767

1768+
if (Val->getOwnershipKind() == OwnershipKind::None) {
1769+
return;
1770+
}
1771+
17691772
if (auto *bbi = dyn_cast<BeginBorrowInst>(Val.getDefiningInstruction())) {
17701773
B.createEndBorrow(silLoc, bbi);
17711774
B.emitDestroyValueOperation(silLoc, bbi->getOperand());

test/AutoDiff/SILGen/autodiff_builtins.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ func test_context_builtins() {
101101
// CHECK-LABEL: sil{{.*}}@test_context_builtins
102102
// CHECK: bb0:
103103
// CHECK: [[CTX:%.*]] = builtin "autoDiffCreateLinearMapContext"({{%.*}} : $Builtin.Word) : $Builtin.NativeObject
104-
// CHECK: [[BORROWED_CTX:%.*]] = begin_borrow [[CTX]] : $Builtin.NativeObject
104+
// CHECK: [[BORROWED_CTX:%.*]] = begin_borrow [lexical] [[CTX]] : $Builtin.NativeObject
105105
// CHECK: [[BUF:%.*]] = builtin "autoDiffProjectTopLevelSubcontext"([[BORROWED_CTX]] : $Builtin.NativeObject) : $Builtin.RawPointer
106-
// CHECK: [[BORROWED_CTX:%.*]] = begin_borrow [[CTX]] : $Builtin.NativeObject
107106
// CHECK: [[BUF:%.*]] = builtin "autoDiffAllocateSubcontext"([[BORROWED_CTX]] : $Builtin.NativeObject, {{.*}} : $Builtin.Word) : $Builtin.RawPointer
108107
// CHECK: destroy_value [[CTX]]

test/AutoDiff/SILOptimizer/activity_analysis.swift

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func testNoDerivativeStructProjection(_ s: HasNoDerivativeProperty) -> Float {
1818

1919
// CHECK-LABEL: [AD] Activity info for ${{.*}}testNoDerivativeStructProjection{{.*}} at parameter indices (0) and result indices (0):
2020
// CHECK: [ACTIVE] %0 = argument of bb0 : $HasNoDerivativeProperty
21-
// CHECK: [ACTIVE] %2 = alloc_stack $HasNoDerivativeProperty, var, name "tmp"
21+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $HasNoDerivativeProperty, var, name "tmp"
2222
// CHECK: [ACTIVE] %4 = begin_access [read] [static] %2 : $*HasNoDerivativeProperty
2323
// CHECK: [ACTIVE] %5 = struct_element_addr %4 : $*HasNoDerivativeProperty, #HasNoDerivativeProperty.x
2424
// CHECK: [VARIED] %6 = load [trivial] %5 : $*Float
@@ -42,7 +42,7 @@ func testNondifferentiableTupleElementAddr<T>(_ x: T) -> T {
4242
// CHECK-LABEL: [AD] Activity info for ${{.*}}testNondifferentiableTupleElementAddr{{.*}} at parameter indices (0) and result indices (0):
4343
// CHECK: [ACTIVE] %0 = argument of bb0 : $*T
4444
// CHECK: [ACTIVE] %1 = argument of bb0 : $*T
45-
// CHECK: [ACTIVE] %3 = alloc_stack $(Int, Int, (T, Int), Int), var, name "tuple"
45+
// CHECK: [ACTIVE] %3 = alloc_stack [lexical] $(Int, Int, (T, Int), Int), var, name "tuple"
4646
// CHECK: [USEFUL] %4 = tuple_element_addr %3 : $*(Int, Int, (T, Int), Int), 0
4747
// CHECK: [USEFUL] %5 = tuple_element_addr %3 : $*(Int, Int, (T, Int), Int), 1
4848
// CHECK: [ACTIVE] %6 = tuple_element_addr %3 : $*(Int, Int, (T, Int), Int), 2
@@ -76,7 +76,7 @@ func TF_781(_ x: Float, _ y: Float) -> Float {
7676
// CHECK-LABEL: [AD] Activity info for ${{.*}}TF_781{{.*}} at parameter indices (0) and result indices (0)
7777
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
7878
// CHECK: [USEFUL] %1 = argument of bb0 : $Float
79-
// CHECK: [ACTIVE] %4 = alloc_stack $Float, var, name "result"
79+
// CHECK: [ACTIVE] %4 = alloc_stack [lexical] $Float, var, name "result"
8080
// CHECK: [ACTIVE] %19 = begin_access [read] [static] %4 : $*Float
8181
// CHECK: [ACTIVE] %20 = load [trivial] %19 : $*Float
8282
// CHECK: [ACTIVE] %23 = apply %22(%20, %0, %18) : $@convention(method) (Float, Float, @thin Float.Type) -> Float
@@ -103,9 +103,9 @@ func TF_954(_ x: Float) -> Float {
103103
// CHECK-LABEL: [AD] Activity info for ${{.*}}TF_954{{.*}} at parameter indices (0) and result indices (0)
104104
// CHECK: bb0:
105105
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
106-
// CHECK: [ACTIVE] %2 = alloc_stack $Float, var, name "outer"
106+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $Float, var, name "outer"
107107
// CHECK: bb1:
108-
// CHECK: [ACTIVE] %10 = alloc_stack $Float, var, name "inner"
108+
// CHECK: [ACTIVE] %10 = alloc_stack [lexical] $Float, var, name "inner"
109109
// CHECK: [ACTIVE] %11 = begin_access [read] [static] %2 : $*Float
110110
// CHECK: [USEFUL] %14 = metatype $@thin Float.Type
111111
// CHECK: [ACTIVE] %15 = begin_access [read] [static] %10 : $*Float
@@ -286,7 +286,7 @@ func testArrayUninitializedIntrinsicAddress(_ x: Float, _ y: Float) -> [Float] {
286286
// CHECK-LABEL: [AD] Activity info for ${{.*}}testArrayUninitializedIntrinsicAddress{{.*}} at parameter indices (0, 1) and result indices (0)
287287
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
288288
// CHECK: [ACTIVE] %1 = argument of bb0 : $Float
289-
// CHECK: [ACTIVE] %4 = alloc_stack $Float, var, name "result"
289+
// CHECK: [ACTIVE] %4 = alloc_stack [lexical] $Float, var, name "result"
290290
// CHECK: [ACTIVE] %7 = begin_access [read] [static] %4 : $*Float
291291
// CHECK: [ACTIVE] %8 = load [trivial] %7 : $*Float
292292
// CHECK: [NONE] // function_ref static Float.* infix(_:_:)
@@ -348,28 +348,28 @@ func testArrayUninitializedIntrinsicNested(_ x: Float, _ y: Float) -> [Float] {
348348
// CHECK: [ACTIVE] %12 = index_addr %9 : $*Float, %11 : $Builtin.Word
349349
// CHECK: [NONE] // function_ref _finalizeUninitializedArray<A>(_:)
350350
// CHECK: [ACTIVE] [[ARRAY:%.*]] = apply %14<Float>(%7) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0>
351-
// CHECK: [USEFUL] %17 = integer_literal $Builtin.Word, 2
351+
// CHECK: [USEFUL] [[INT_LIT:%.*]] = integer_literal $Builtin.Word, 2
352352
// CHECK: [NONE] // function_ref _allocateUninitializedArray<A>(_:)
353-
// CHECK: [ACTIVE] %19 = apply %18<Float>(%17) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer)
354-
// CHECK: [ACTIVE] (**%20**, %21) = destructure_tuple %19 : $(Array<Float>, Builtin.RawPointer)
355-
// CHECK: [VARIED] (%20, **%21**) = destructure_tuple %19 : $(Array<Float>, Builtin.RawPointer)
356-
// CHECK: [ACTIVE] %22 = pointer_to_address %21 : $Builtin.RawPointer to [strict] $*Float
357-
// CHECK: [USEFUL] %23 = integer_literal $Builtin.IntLiteral, 0
358-
// CHECK: [USEFUL] %24 = metatype $@thin Int.Type
353+
// CHECK: [ACTIVE] [[TUP:%.*]] = apply %19<Float>([[INT_LIT]]) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer)
354+
// CHECK: [ACTIVE] (**[[LHS:%.*]]**, [[RHS:%.*]]) = destructure_tuple [[TUP]] : $(Array<Float>, Builtin.RawPointer)
355+
// CHECK: [VARIED] ([[LHS]], **[[RHS]]**) = destructure_tuple [[TUP]] : $(Array<Float>, Builtin.RawPointer)
356+
// CHECK: [ACTIVE] [[FLOAT_PTR:%.*]] = pointer_to_address [[RHS]] : $Builtin.RawPointer to [strict] $*Float
357+
// CHECK: [USEFUL] [[ZERO_LITERAL:%.*]] = integer_literal $Builtin.IntLiteral, 0
358+
// CHECK: [USEFUL] [[META:%.*]] = metatype $@thin Int.Type
359359
// CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:)
360-
// CHECK: [USEFUL] %26 = apply %25(%23, %24) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
360+
// CHECK: [USEFUL] [[RESULT_2:%.*]] = apply %26([[ZERO_LITERAL]], [[META]]) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
361361
// CHECK: [NONE] // function_ref Array.subscript.getter
362-
// CHECK: [NONE] %28 = apply %27<Float>(%22, %26, %15) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
363-
// CHECK: [VARIED] %29 = integer_literal $Builtin.Word, 1
364-
// CHECK: [ACTIVE] %30 = index_addr %22 : $*Float, %29 : $Builtin.Word
365-
// CHECK: [USEFUL] %31 = integer_literal $Builtin.IntLiteral, 1
366-
// CHECK: [USEFUL] %32 = metatype $@thin Int.Type
362+
// CHECK: [NONE] %29 = apply %28<Float>([[FLOAT_PTR]], [[RESULT_2]], %16) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
363+
// CHECK: [VARIED] [[ONE_LITERAL:%.*]] = integer_literal $Builtin.Word, 1
364+
// CHECK: [ACTIVE] [[INDEX_ADDR:%.*]] = index_addr [[FLOAT_PTR]] : $*Float, [[ONE_LITERAL]] : $Builtin.Word
365+
// CHECK: [USEFUL] [[ONE_LITERAL_AGAIN:%.*]] = integer_literal $Builtin.IntLiteral, 1
366+
// CHECK: [USEFUL] [[META_AGAIN:%.*]] = metatype $@thin Int.Type
367367
// CHECK: [NONE] // function_ref Int.init(_builtinIntegerLiteral:)
368-
// CHECK: [USEFUL] %34 = apply %33(%31, %32) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
368+
// CHECK: [USEFUL] %35 = apply %34([[ONE_LITERAL_AGAIN]], [[META_AGAIN]]) : $@convention(method) (Builtin.IntLiteral, @thin Int.Type) -> Int
369369
// CHECK: [NONE] // function_ref Array.subscript.getter
370-
// CHECK: [NONE] %36 = apply %35<Float>(%30, %34, %15) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
370+
// CHECK: [NONE] %37 = apply %36<Float>(%31, %35, %16) : $@convention(method) <τ_0_0> (Int, @guaranteed Array<τ_0_0>) -> @out τ_0_0
371371
// CHECK: [NONE] // function_ref _finalizeUninitializedArray<A>(_:)
372-
// CHECK: [ACTIVE] %38 = apply %37<Float>(%20) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0>
372+
// CHECK: [ACTIVE] %39 = apply %38<Float>(%21) : $@convention(thin) <τ_0_0> (@owned Array<τ_0_0>) -> @owned Array<τ_0_0>
373373

374374
// TF-978: Test array literal initialized with `apply` indirect results.
375375
struct Wrapper<T: Differentiable>: Differentiable {
@@ -440,7 +440,7 @@ func activeInoutArgMutatingMethod(_ x: Mut) -> Mut {
440440

441441
// CHECK-LABEL: [AD] Activity info for ${{.*}}28activeInoutArgMutatingMethodyAA3MutVADF at parameter indices (0) and result indices (0)
442442
// CHECK: [ACTIVE] %0 = argument of bb0 : $Mut
443-
// CHECK: [ACTIVE] %2 = alloc_stack $Mut, var, name "result"
443+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $Mut, var, name "result"
444444
// CHECK: [ACTIVE] %4 = begin_access [read] [static] %2 : $*Mut
445445
// CHECK: [ACTIVE] %5 = load [trivial] %4 : $*Mut
446446
// CHECK: [ACTIVE] %7 = begin_access [modify] [static] %2 : $*Mut
@@ -459,7 +459,7 @@ func activeInoutArgMutatingMethodVar(_ nonactive: inout Mut, _ x: Mut) {
459459
// CHECK_LABEL: [AD] Activity info for ${{.*}}31activeInoutArgMutatingMethodVaryyAA3MutVz_ADtF at (parameters=(1) results=(0))
460460
// CHECK: [ACTIVE] %0 = argument of bb0 : $*Mut
461461
// CHECK: [ACTIVE] %1 = argument of bb0 : $Mut
462-
// CHECK: [ACTIVE] %4 = alloc_stack $Mut, var, name "result"
462+
// CHECK: [ACTIVE] %4 = alloc_stack [lexical] $Mut, var, name "result"
463463
// CHECK: [ACTIVE] %5 = begin_access [read] [static] %0 : $*Mut
464464
// CHECK: [ACTIVE] %8 = begin_access [modify] [static] %4 : $*Mut
465465
// CHECK: [NONE] // function_ref Mut.mutatingMethod(_:)
@@ -480,7 +480,7 @@ func activeInoutArgMutatingMethodTuple(_ nonactive: inout Mut, _ x: Mut) {
480480
// CHECK-LABEL: [AD] Activity info for ${{.*}}33activeInoutArgMutatingMethodTupleyyAA3MutVz_ADtF at parameter indices (1) and result indices (0)
481481
// CHECK: [ACTIVE] %0 = argument of bb0 : $*Mut
482482
// CHECK: [ACTIVE] %1 = argument of bb0 : $Mut
483-
// CHECK: [ACTIVE] %4 = alloc_stack $(Mut, Mut), var, name "result"
483+
// CHECK: [ACTIVE] %4 = alloc_stack [lexical] $(Mut, Mut), var, name "result"
484484
// CHECK: [ACTIVE] %5 = tuple_element_addr %4 : $*(Mut, Mut), 0
485485
// CHECK: [ACTIVE] %6 = tuple_element_addr %4 : $*(Mut, Mut), 1
486486
// CHECK: [ACTIVE] %7 = begin_access [read] [static] %0 : $*Mut
@@ -507,7 +507,7 @@ func activeInoutArg(_ x: Float) -> Float {
507507

508508
// CHECK-LABEL: [AD] Activity info for ${{.*}}activeInoutArg{{.*}} at parameter indices (0) and result indices (0)
509509
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
510-
// CHECK: [ACTIVE] %2 = alloc_stack $Float, var, name "result"
510+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $Float, var, name "result"
511511
// CHECK: [ACTIVE] %5 = begin_access [modify] [static] %2 : $*Float
512512
// CHECK: [NONE] // function_ref static Float.+= infix(_:_:)
513513
// CHECK: [NONE] %7 = apply %6(%5, %0, %4) : $@convention(method) (@inout Float, Float, @thin Float.Type) -> ()
@@ -523,7 +523,7 @@ func activeInoutArgNonactiveInitialResult(_ x: Float) -> Float {
523523

524524
// CHECK-LABEL: [AD] Activity info for ${{.*}}activeInoutArgNonactiveInitialResult{{.*}} at parameter indices (0) and result indices (0)
525525
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
526-
// CHECK: [ACTIVE] %2 = alloc_stack $Float, var, name "result"
526+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $Float, var, name "result"
527527
// CHECK: [NONE] // function_ref Float.init(_builtinIntegerLiteral:)
528528
// CHECK: [USEFUL] %6 = apply %5(%3, %4) : $@convention(method) (Builtin.IntLiteral, @thin Float.Type) -> Float
529529
// CHECK: [USEFUL] %8 = metatype $@thin Float.Type
@@ -586,7 +586,7 @@ func testAccessorCoroutines(_ x: HasCoroutineAccessors) -> HasCoroutineAccessors
586586

587587
// CHECK-LABEL: [AD] Activity info for ${{.*}}testAccessorCoroutines{{.*}} at parameter indices (0) and result indices (0)
588588
// CHECK: [ACTIVE] %0 = argument of bb0 : $HasCoroutineAccessors
589-
// CHECK: [ACTIVE] %2 = alloc_stack $HasCoroutineAccessors, var, name "x"
589+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $HasCoroutineAccessors, var, name "x"
590590
// CHECK: [ACTIVE] %4 = begin_access [read] [static] %2 : $*HasCoroutineAccessors
591591
// CHECK: [ACTIVE] %5 = load [trivial] %4 : $*HasCoroutineAccessors
592592
// CHECK: [NONE] // function_ref HasCoroutineAccessors.computed.read
@@ -619,7 +619,7 @@ func testBeginApplyActiveInoutArgument(array: [Float], x: Float) -> Float {
619619
// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveInoutArgument{{.*}} at parameter indices (0, 1) and result indices (0)
620620
// CHECK: [ACTIVE] %0 = argument of bb0 : $Array<Float>
621621
// CHECK: [ACTIVE] %1 = argument of bb0 : $Float
622-
// CHECK: [ACTIVE] %4 = alloc_stack $Array<Float>, var, name "array"
622+
// CHECK: [ACTIVE] %4 = alloc_stack [lexical] $Array<Float>, var, name "array"
623623
// CHECK: [ACTIVE] %5 = copy_value %0 : $Array<Float>
624624
// CHECK: [USEFUL] %7 = integer_literal $Builtin.IntLiteral, 0
625625
// CHECK: [USEFUL] %8 = metatype $@thin Int.Type
@@ -656,7 +656,7 @@ func testBeginApplyActiveButInitiallyNonactiveInoutArgument(x: Float) -> Float {
656656

657657
// CHECK-LABEL: [AD] Activity info for ${{.*}}testBeginApplyActiveButInitiallyNonactiveInoutArgument{{.*}} at parameter indices (0) and result indices (0)
658658
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
659-
// CHECK: [ACTIVE] %2 = alloc_stack $Array<Float>, var, name "array"
659+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $Array<Float>, var, name "array"
660660
// CHECK: [USEFUL] %3 = integer_literal $Builtin.Word, 1
661661
// CHECK: [NONE] // function_ref _allocateUninitializedArray<A>(_:)
662662
// CHECK: [USEFUL] %5 = apply %4<Float>(%3) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer)
@@ -756,7 +756,7 @@ func testActiveOptional(_ x: Float) -> Float {
756756
// CHECK-LABEL: [AD] Activity info for ${{.*}}testActiveOptional{{.*}} at parameter indices (0) and result indices (0)
757757
// CHECK: bb0:
758758
// CHECK: [ACTIVE] %0 = argument of bb0 : $Float
759-
// CHECK: [ACTIVE] %2 = alloc_stack $Optional<Float>, var, name "maybe"
759+
// CHECK: [ACTIVE] %2 = alloc_stack [lexical] $Optional<Float>, var, name "maybe"
760760
// CHECK: [USEFUL] %3 = integer_literal $Builtin.IntLiteral, 10
761761
// CHECK: [USEFUL] %4 = metatype $@thin Float.Type
762762
// CHECK: [NONE] // function_ref Float.init(_builtinIntegerLiteral:)

test/AutoDiff/SILOptimizer/differentiation_diagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ func modify(_ s: Struct, _ x: Float) -> Float {
714714
func tupleArrayLiteralInitialization(_ x: Float, _ y: Float) -> Float {
715715
// `Array<(Float, Float)>` does not conform to `Differentiable`.
716716
let array = [(x * y, x * y)]
717-
// expected-note @-1 {{cannot differentiate through a non-differentiable argument; do you want to use 'withoutDerivative(at:)'?}} {{15-15=withoutDerivative(at: }} {{31-31=)}}
717+
// expected-note @-1 {{cannot differentiate through a non-differentiable argument; do you want to use 'withoutDerivative(at:)'?}} {{7-7=withoutDerivative(at: }} {{12-12=)}}
718718
return array[0].0
719719
}
720720

test/AutoDiff/validation-test/array.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-run-simple-swift
1+
// RUN: %target-run-simple-swift(-Xfrontend -disable-lexical-lifetimes)
2+
23
// REQUIRES: executable_test
34

45
// Would fail due to unavailability of swift_autoDiffCreateLinearMapContext.

test/AutoDiff/validation-test/optional.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// RUN: %target-run-simple-swift
1+
// RUN: %target-run-simple-swift(-Xfrontend -disable-lexical-lifetimes)
2+
23
// REQUIRES: executable_test
34

45
// Test differentiation of `Optional` values and operations.

test/AutoDiff/validation-test/optional_property.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// RUN: %target-run-simple-swift
2-
// RUN: %target-swift-emit-sil -Xllvm -debug-only=differentiation -module-name null -o /dev/null 2>&1 %s | %FileCheck %s
1+
// RUN: %target-run-simple-swift(-Xfrontend -disable-lexical-lifetimes)
2+
// RUN: %target-swift-emit-sil -Xllvm -debug-only=differentiation -disable-lexical-lifetimes -module-name null -o /dev/null 2>&1 %s | %FileCheck %s
3+
34
// REQUIRES: executable_test
45
// REQUIRES: asserts
56

test/DebugInfo/if-branchlocations.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %target-swift-frontend %s -emit-sil -disable-copy-propagation -emit-verbose-sil -g -o - | %FileCheck %s --check-prefixes=CHECK,CHECK-NCP
2-
// RUN: %target-swift-frontend %s -emit-sil -enable-copy-propagation -emit-verbose-sil -g -o - | %FileCheck %s --check-prefixes=CHECK,CHECK-CP
2+
// RUN: %target-swift-frontend %s -emit-sil -enable-copy-propagation -disable-lexical-lifetimes -emit-verbose-sil -g -o - | %FileCheck %s --check-prefixes=CHECK,CHECK-CP
33

44
class NSURL {}
55

test/DebugInfo/linetable-do.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle %s -emit-ir -g -o - | %FileCheck %s
22
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -disable-copy-propagation %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck --check-prefixes=CHECK-SIL,CHECK-NCP %s
3-
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -enable-copy-propagation %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck --check-prefixes=CHECK-SIL,CHECK-CP %s
3+
// RUN: %target-swift-frontend -Xllvm -sil-full-demangle -enable-copy-propagation -disable-lexical-lifetimes %s -emit-sil -emit-verbose-sil -g -o - | %FileCheck --check-prefixes=CHECK-SIL,CHECK-CP %s
44
import StdlibUnittest
55

66
class Obj {}

test/IRGen/debug_poison.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -primary-file %s -emit-ir -Onone -enable-copy-propagation | %FileCheck %s -DINT=i%target-ptrsize
1+
// RUN: %target-swift-frontend -primary-file %s -emit-ir -Onone -enable-copy-propagation -disable-lexical-lifetimes | %FileCheck %s -DINT=i%target-ptrsize
22

33
// Test debug_value [poison] emission
44

test/Interpreter/builtin_bridge_object.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-run-simple-swift(-Onone -parse-stdlib -Xfrontend -enable-copy-propagation) | %FileCheck %s --check-prefixes=CHECK,CHECK-DBG
2-
// RUN: %target-run-simple-swift(-O -parse-stdlib -Xfrontend -enable-copy-propagation) | %FileCheck --check-prefixes=CHECK,CHECK-OPT %s
1+
// RUN: %target-run-simple-swift(-Onone -parse-stdlib -Xfrontend -enable-copy-propagation -Xfrontend -disable-lexical-lifetimes) | %FileCheck %s --check-prefixes=CHECK,CHECK-DBG
2+
// RUN: %target-run-simple-swift(-O -parse-stdlib -Xfrontend -enable-copy-propagation -Xfrontend -disable-lexical-lifetimes) | %FileCheck --check-prefixes=CHECK,CHECK-OPT %s
33

44
// REQUIRES: executable_test
55
// REQUIRES: objc_interop

0 commit comments

Comments
 (0)