1 ; RUN: opt %s -globalopt -argpromotion -sroa -S | FileCheck %s
2 ; RUN: opt %s -passes='module(globalopt),cgscc(argpromotion),function(sroa)' -S | FileCheck %s
4 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"
6 %struct.ss = type { i32, i32 }
8 ; Argpromote + sroa should change this to passing the two integers by value.
9 define internal i32 @f(%struct.ss* inalloca %s) {
11 %f0 = getelementptr %struct.ss, %struct.ss* %s, i32 0, i32 0
12 %f1 = getelementptr %struct.ss, %struct.ss* %s, i32 0, i32 1
13 %a = load i32, i32* %f0, align 4
14 %b = load i32, i32* %f1, align 4
18 ; CHECK-LABEL: define internal fastcc i32 @f
24 %S = alloca inalloca %struct.ss
25 %f0 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 0
26 %f1 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 1
27 store i32 1, i32* %f0, align 4
28 store i32 2, i32* %f1, align 4
29 %r = call i32 @f(%struct.ss* inalloca %S)
32 ; CHECK-LABEL: define i32 @main
36 ; Argpromote can't promote %a because of the icmp use.
37 define internal i1 @g(%struct.ss* %a, %struct.ss* inalloca %b) nounwind {
38 ; CHECK: define internal fastcc i1 @g(%struct.ss* %a, %struct.ss* %b)
40 %c = icmp eq %struct.ss* %a, %b
46 %S = alloca inalloca %struct.ss
47 %c = call i1 @g(%struct.ss* %S, %struct.ss* inalloca %S)
48 ; CHECK: call fastcc i1 @g(%struct.ss* %S, %struct.ss* %S)