When removing a function from the function set and adding it to deferred, we
[llvm.git] / test / Transforms / ArgumentPromotion / 2008-07-02-array-indexing.ll
blobd7d5eb548a1c5e3cd8ec6f65dfdff704e83861f2
1 ; RUN: opt < %s -argpromotion -S > %t
2 ; RUN: cat %t | grep {define.*@callee(.*i32\\*}
3 ; PR2498
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
7 define internal i32 @callee(i1 %C, i32* %A) {
8 entry:
9         ; Unconditonally load the element at %A
10         %A.0 = load i32* %A
11         br i1 %C, label %T, label %F
13         ret i32 %A.0
15         ; Load the element at offset two from %A. This should not be promoted!
16         %A.2 = getelementptr i32* %A, i32 2
17         %R = load i32* %A.2
18         ret i32 %R
21 define i32 @foo() {
22         %X = call i32 @callee(i1 false, i32* null)             ; <i32> [#uses=1]
23         ret i32 %X