File: large_argument_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 (38 lines) | stat: -rw-r--r-- 1,507 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
// RUN: %target-swift-frontend %s -Osize -Xllvm -sil-disable-pass=lower-aggregate-instrs -disable-large-loadable-types-reg2mem -import-objc-header %S/Inputs/large_argument_result_c.h -emit-ir -o - 2>&1 | %FileCheck %s

// REQUIRES: PTRSIZE=64
// REQUIRES: CPU=arm64 || CPU=arm64e

sil_stage lowered

import Builtin
import Swift
import SwiftShims

struct ContainingLargeThing {
  var y : large_thing
  var x : large_thing
}

sil @pass_and_return : $@convention(c) (large_thing, large_thing) -> large_thing

// Make sure that we are not dropping the struct_element_addr projection on the
// floor

// CHECK: define{{.*}} swiftcc void @test(ptr {{.*}} dereferenceable(256) %0)
// CHECK:   [[TMP:%.*]] = alloca %TSo11large_thinga
// CHECK:   [[PROJ_ADDR:%.*]] = getelementptr inbounds i8, ptr %0, i64 128
// CHECK:   [[VAL:%.*]] = load i64, ptr %.sroa.3.0..sroa_idx
// CHECK:   store i64 [[VAL]], ptr [[TMP]]
sil @test : $@convention(thin) (@in ContainingLargeThing) -> () {
bb0(%0 : $*ContainingLargeThing):
  %1 = alloc_stack $ContainingLargeThing
  copy_addr [take] %0 to [init] %1 : $*ContainingLargeThing
	%2 = struct_element_addr %1 : $*ContainingLargeThing, #ContainingLargeThing.x
  %3 = function_ref @pass_and_return : $@convention(c) (large_thing, large_thing) -> large_thing
  %4 = load %2 : $*large_thing                    // user: %9
  %5 = apply %3(%4, %4) : $@convention(c) (large_thing, large_thing) -> large_thing
  dealloc_stack %1 : $*ContainingLargeThing
  %6 = tuple()
  return %6 : $()
}