blob: 08a1b805cf600aee62d3a05b485fe5200b353168 [file] [log] [blame]
Dan Gohman18800922009-09-11 18:01:28 +00001; RUN: opt < %s -argpromotion -S > %t
Chandler Carrutha5a29f92012-07-02 12:47:22 +00002; RUN: cat %t | grep "define.*@callee(.*i32\*"
Matthijs Kooijmanfd307042008-07-29 10:00:13 +00003; PR2498
4
5; This test tries to convince argpromotion about promoting the load from %A + 2,
6; because there is a load of %A in the entry block
7define internal i32 @callee(i1 %C, i32* %A) {
8entry:
9 ; Unconditonally load the element at %A
10 %A.0 = load i32* %A
11 br i1 %C, label %T, label %F
12T:
13 ret i32 %A.0
14F:
15 ; Load the element at offset two from %A. This should not be promoted!
David Blaikie79e6c742015-02-27 19:29:02 +000016 %A.2 = getelementptr i32, i32* %A, i32 2
Matthijs Kooijmanfd307042008-07-29 10:00:13 +000017 %R = load i32* %A.2
18 ret i32 %R
19}
20
21define i32 @foo() {
22 %X = call i32 @callee(i1 false, i32* null) ; <i32> [#uses=1]
23 ret i32 %X
24}
25