• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -argpromotion -S | FileCheck %s
2; PR2498
3
4; This test tries to convince argpromotion about promoting the load from %A + 2,
5; because there is a load of %A in the entry block
6define internal i32 @callee(i1 %C, i32* %A) {
7; CHECK-LABEL: define internal i32 @callee(
8; CHECK: i1 %C, i32* %A)
9entry:
10  ; Unconditonally load the element at %A
11  %A.0 = load i32, i32* %A
12  br i1 %C, label %T, label %F
13
14T:
15  ret i32 %A.0
16
17F:
18  ; Load the element at offset two from %A. This should not be promoted!
19  %A.2 = getelementptr i32, i32* %A, i32 2
20  %R = load i32, i32* %A.2
21  ret i32 %R
22}
23
24define i32 @foo() {
25; CHECK-LABEL: define i32 @foo
26        %X = call i32 @callee(i1 false, i32* null)             ; <i32> [#uses=1]
27; CHECK: call i32 @callee(i1 false, i32* null)
28        ret i32 %X
29}
30
31