File: mem2reg_unreachable.sil

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (58 lines) | stat: -rw-r--r-- 2,113 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// 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 %0 : $*S, let, name "newvalue", argno 1, expr op_deref
  br bb2

bb2:
  %3 = load %0 : $*S
  dealloc_stack %0 : $*S
  %4 = tuple ()
  return %4 : $()
}