blob: 55fc036f177503b6f7ed08a25c5ea0ac5d0bac82 [file] [log] [blame]
Peter Collingbourne115fe372015-06-10 21:14:34 +00001; RUN: opt < %s -argpromotion -S | FileCheck %s
Chandler Carruthaddcda42017-02-09 23:46:27 +00002; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
Peter Collingbourne115fe372015-06-10 21:14:34 +00003
4target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
5target triple = "x86_64-pc-windows-msvc"
6
7; CHECK: define internal void @add(i32 %[[THIS1:.*]], i32 %[[THIS2:.*]], i32* noalias %[[SR:.*]])
8define internal void @add({i32, i32}* %this, i32* sret %r) {
9 %ap = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 0
10 %bp = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 1
11 %a = load i32, i32* %ap
12 %b = load i32, i32* %bp
13 ; CHECK: %[[AB:.*]] = add i32 %[[THIS1]], %[[THIS2]]
14 %ab = add i32 %a, %b
15 ; CHECK: store i32 %[[AB]], i32* %[[SR]]
16 store i32 %ab, i32* %r
17 ret void
18}
19
20; CHECK: define void @f()
21define void @f() {
22 ; CHECK: %[[R:.*]] = alloca i32
23 %r = alloca i32
24 %pair = alloca {i32, i32}
25
26 ; CHECK: call void @add(i32 %{{.*}}, i32 %{{.*}}, i32* noalias %[[R]])
27 call void @add({i32, i32}* %pair, i32* sret %r)
28 ret void
29}