diff --git a/lib/SIL/Verifier/SILVerifier.cpp b/lib/SIL/Verifier/SILVerifier.cpp index 9ff86c7a2b419..aa8776fecdede 100644 --- a/lib/SIL/Verifier/SILVerifier.cpp +++ b/lib/SIL/Verifier/SILVerifier.cpp @@ -546,6 +546,7 @@ struct ImmutableAddressUseVerifier { case SILInstructionKind::FixLifetimeInst: case SILInstructionKind::KeyPathInst: case SILInstructionKind::SwitchEnumAddrInst: + case SILInstructionKind::SelectEnumAddrInst: break; case SILInstructionKind::AddressToPointerInst: // We assume that the user is attempting to do something unsafe since we diff --git a/test/SIL/memory_lifetime.sil b/test/SIL/memory_lifetime.sil index f9bf57bf5cfa9..ae06853e8a5db 100644 --- a/test/SIL/memory_lifetime.sil +++ b/test/SIL/memory_lifetime.sil @@ -377,3 +377,20 @@ bb6(%45 : @owned $Error): br bb4(%45 : $Error) } +sil [ossa] @test_memory_lifetime_select_enum : $@convention(thin) (@in_guaranteed Optional) -> () { +bb0(%0 : $*Optional): + %2 = integer_literal $Builtin.Int1, 0 + %3 = integer_literal $Builtin.Int1, 1 + %4 = select_enum_addr %0 : $*Optional, case #Optional.none!enumelt: %2, case #Optional.some!enumelt: %3 : $Builtin.Int1 + cond_br %4, bb1, bb2 + +bb1: + br bb3 + +bb2: + br bb3 + +bb3: + %9999 = tuple() + return %9999 : $() +}