mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix verifier error in CastOptimizer
While removing an invalid cast and inserting traps, we are currently inserting a store of undef to the cast destination and delete all instructions after the cast except for dealloc_stack. If the cast destination was an alloc_stack, the verifier could raise an error saying the cast destination was initialized at the dealloc. This PR deletes the store to undef, destroy_addr of the cast src, and gets rid of the code that was retaining the dealloc_stack. None of this is necessary anymore and the SIL is going to be legal because we insert unreachable instruction.
This commit is contained in:
@@ -1583,10 +1583,10 @@ bb0(%0 : $Builtin.RawPointer, %1 : $Builtin.Word):
|
||||
return %28 : $()
|
||||
}
|
||||
|
||||
// CHECK-LABEL: sil @test_end_lifetime : $@convention(thin) (@owned Builtin.NativeObject) -> () {
|
||||
// CHECK-LABEL: sil [ossa] @test_end_lifetime : $@convention(thin) (@owned Builtin.NativeObject) -> () {
|
||||
// CHECK: end_lifetime {{%.*}} : $Builtin.NativeObject
|
||||
sil @test_end_lifetime : $@convention(thin) (@owned Builtin.NativeObject) -> () {
|
||||
bb0(%0 : $Builtin.NativeObject):
|
||||
sil [ossa] @test_end_lifetime : $@convention(thin) (@owned Builtin.NativeObject) -> () {
|
||||
bb0(%0 : @owned $Builtin.NativeObject):
|
||||
end_lifetime %0 : $Builtin.NativeObject
|
||||
return undef : $()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user