1 ; RUN: opt %s -argpromotion -scalarrepl -S | FileCheck %s
3 target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
5 %struct.ss = type { i32, i32 }
7 ; Argpromote + scalarrepl should change this to passing the two integers by value.
8 define internal i32 @f(%struct.ss* inalloca %s) {
10 %f0 = getelementptr %struct.ss* %s, i32 0, i32 0
11 %f1 = getelementptr %struct.ss* %s, i32 0, i32 1
12 %a = load i32* %f0, align 4
13 %b = load i32* %f1, align 4
17 ; CHECK-LABEL: define internal i32 @f
23 %S = alloca inalloca %struct.ss
24 %f0 = getelementptr %struct.ss* %S, i32 0, i32 0
25 %f1 = getelementptr %struct.ss* %S, i32 0, i32 1
26 store i32 1, i32* %f0, align 4
27 store i32 2, i32* %f1, align 4
28 %r = call i32 @f(%struct.ss* inalloca %S)
31 ; CHECK-LABEL: define i32 @main
35 ; Argpromote can't promote %a because of the icmp use.
36 define internal i1 @g(%struct.ss* %a, %struct.ss* inalloca %b) nounwind {
37 ; CHECK: define internal i1 @g(%struct.ss* %a, %struct.ss* inalloca %b)
39 %c = icmp eq %struct.ss* %a, %b
45 %S = alloca inalloca %struct.ss
46 %c = call i1 @g(%struct.ss* %S, %struct.ss* inalloca %S)
47 ; CHECK: call i1 @g(%struct.ss* %S, %struct.ss* inalloca %S)