1 ; RUN: llvm-as < %s | opt -sretpromotion | llvm-dis > %t
2 ; RUN: cat %t | grep sret | count 1
4 ; This function is promotable
5 define internal void @promotable({i32, i32}* sret %s) {
6 %A = getelementptr {i32, i32}* %s, i32 0, i32 0
8 %B = getelementptr {i32, i32}* %s, i32 0, i32 0
13 ; This function is not promotable (due to it's use below)
14 define internal void @notpromotable({i32, i32}* sret %s) {
15 %A = getelementptr {i32, i32}* %s, i32 0, i32 0
17 %B = getelementptr {i32, i32}* %s, i32 0, i32 0
22 define void @caller({i32, i32}* %t) {
23 %s = alloca {i32, i32}
24 call void @promotable({i32, i32}* %s)
25 %A = getelementptr {i32, i32}* %s, i32 0, i32 0
27 %B = getelementptr {i32, i32}* %s, i32 0, i32 0
29 ; This passes in something that's not an alloca, which makes the argument not
31 call void @notpromotable({i32, i32}* %t)