blob: 6a60e6144d944840797a59ab05188390351648c6 [file] [log] [blame]
Dan Gohman3c7d3082009-09-11 18:01:28 +00001; RUN: opt < %s -argpromotion -instcombine -S | not grep load
Dan Gohmanf17a25c2007-07-18 16:29:46 +00002
Tanya Lattner4c4d0b82008-03-01 09:15:35 +00003%QuadTy = type { i32, i32, i32, i32 }
4@G = constant %QuadTy {
5 i32 0,
6 i32 0,
7 i32 17,
8 i32 25 } ; <%QuadTy*> [#uses=1]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00009
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000010define internal i32 @test(%QuadTy* %P) {
11 %A = getelementptr %QuadTy* %P, i64 0, i32 3 ; <i32*> [#uses=1]
12 %B = getelementptr %QuadTy* %P, i64 0, i32 2 ; <i32*> [#uses=1]
13 %a = load i32* %A ; <i32> [#uses=1]
14 %b = load i32* %B ; <i32> [#uses=1]
15 %V = add i32 %a, %b ; <i32> [#uses=1]
16 ret i32 %V
Dan Gohmanf17a25c2007-07-18 16:29:46 +000017}
18
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000019define i32 @caller() {
20 %V = call i32 @test( %QuadTy* @G ) ; <i32> [#uses=1]
21 ret i32 %V
Dan Gohmanf17a25c2007-07-18 16:29:46 +000022}
Tanya Lattner4c4d0b82008-03-01 09:15:35 +000023