mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
I am doing this separately from the actual change to eliminate the option to make it easier to review.
59 lines
2.1 KiB
Plaintext
59 lines
2.1 KiB
Plaintext
// RUN: %target-sil-opt -enable-sil-verify-all %s -mem2reg
|
|
|
|
// Make sure we are not crashing on blocks that are not dominated by the entry block.
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
sil @_TF4main3fooFT1xSi1ySi_Si : $@convention(thin) (Int32, Int32) -> Int32 {
|
|
bb0(%0 : $Int32, %1 : $Int32):
|
|
debug_value %0 : $Int32, let, name "x" // id: %2
|
|
debug_value %1 : $Int32, let, name "y" // id: %3
|
|
%4 = alloc_stack $Int32, var, name "g" // users: %14, %18, %20, %21
|
|
%6 = struct_extract %1 : $Int32, #Int32._value // user: %8
|
|
%7 = struct_extract %0 : $Int32, #Int32._value // user: %8
|
|
%8 = builtin "cmp_sgt_Word"(%6 : $Builtin.Int32, %7 : $Builtin.Int32) : $Builtin.Int1 // user: %9
|
|
%9 = struct $Bool (%8 : $Builtin.Int1) // user: %10
|
|
%10 = struct_extract %9 : $Bool, #Bool._value // user: %11
|
|
br bb2 // id: %11
|
|
|
|
bb1: // Preds: bb0
|
|
%12 = integer_literal $Builtin.Int32, 5 // user: %13
|
|
%13 = struct $Int32 (%12 : $Builtin.Int32) // user: %14
|
|
store %13 to %4 : $*Int32 // id: %14
|
|
br bb3 // id: %15
|
|
|
|
bb2: // Preds: bb0
|
|
%16 = integer_literal $Builtin.Int32, 4 // user: %17
|
|
%17 = struct $Int32 (%16 : $Builtin.Int32) // user: %18
|
|
store %17 to %4 : $*Int32 // id: %18
|
|
br bb3 // id: %19
|
|
|
|
bb3: // Preds: bb1 bb2
|
|
%20 = load %4 : $*Int32 // user: %22
|
|
dealloc_stack %4 : $*Int32 // id: %21
|
|
return %20 : $Int32 // id: %22
|
|
}
|
|
|
|
struct S {}
|
|
|
|
sil hidden @handle_unreachable : $@convention(thin) () -> () {
|
|
bb0:
|
|
%0 = alloc_stack $S, var, name "x"
|
|
%1 = struct $S ()
|
|
store %1 to %0 : $*S
|
|
unreachable
|
|
|
|
bb1:
|
|
debug_value_addr %0 : $*S, let, name "newvalue", argno 1
|
|
br bb2
|
|
|
|
bb2:
|
|
%3 = load %0 : $*S
|
|
dealloc_stack %0 : $*S
|
|
%4 = tuple ()
|
|
return %4 : $()
|
|
}
|