File: dead_store_elim_c.sil

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (42 lines) | stat: -rw-r--r-- 1,499 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
// RUN: %target-sil-opt %s -dead-store-elimination -I %S/Inputs/include | %FileCheck %s

sil_stage canonical

import Builtin
import Swift
import SwiftShims
import CUnion


sil [noinline] @modify_U : $@convention(thin) (@inout U) -> () {
[%0: read v**]
[global: read,write,copy,destroy,allocate,deinit_barrier]
}

// CHECK-LABEL: sil @pointer_escape_via_c_union :
// CHECK:         store %0 to %1
// CHECK:       } // end sil function 'pointer_escape_via_c_union'
sil @pointer_escape_via_c_union : $@convention(thin) (S) -> () {
[global: read,write,copy,destroy,allocate,deinit_barrier]
bb0(%0 : $S):
  %1 = alloc_stack [var_decl] $S, var, name "vs"
  store %0 to %1 : $*S
  %3 = address_to_pointer [stack_protection] %1 : $*S to $Builtin.RawPointer
  %4 = struct $UnsafeMutablePointer<S> (%3 : $Builtin.RawPointer)
  %5 = alloc_stack [var_decl] $U, var, name "u"
  %6 = enum $Optional<UnsafeMutablePointer<S>>, #Optional.some!enumelt, %4 : $UnsafeMutablePointer<S>
  %7 = alloc_stack [var_decl] $U
  %8 = address_to_pointer %7 : $*U to $Builtin.RawPointer
  %9 = pointer_to_address %8 : $Builtin.RawPointer to [strict] $*Optional<UnsafeMutablePointer<S>>
  store %6 to %9 : $*Optional<UnsafeMutablePointer<S>>
  %11 = load %7 : $*U
  dealloc_stack %7 : $*U
  store %11 to %5 : $*U
  %14 = function_ref @modify_U : $@convention(thin) (@inout U) -> ()
  %15 = apply %14(%5) : $@convention(thin) (@inout U) -> ()
  dealloc_stack %5 : $*U
  dealloc_stack %1 : $*S
  %18 = tuple ()
  return %18 : $()
}