blob: d4883e78bf6f6175f75c128f09058551ed92b14e [file] [log] [blame]
Dan Gohman3e054fe2009-09-08 22:34:10 +00001; RUN: opt %s -argpromotion -instcombine -S | not grep load
Chris Lattner95481b12004-03-08 00:58:19 +00002
Tanya Lattnerec9a35a2008-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]
Chris Lattner95481b12004-03-08 00:58:19 +00009
Tanya Lattnerec9a35a2008-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
Chris Lattner95481b12004-03-08 00:58:19 +000017}
18
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000019define i32 @caller() {
20 %V = call i32 @test( %QuadTy* @G ) ; <i32> [#uses=1]
21 ret i32 %V
Chris Lattner95481b12004-03-08 00:58:19 +000022}
Tanya Lattnerec9a35a2008-03-01 09:15:35 +000023