• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s -argpromotion -S | FileCheck %s
2; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
3
4@G1 = constant i32 0
5@G2 = constant i32* @G1
6
7define internal i32 @test(i32** %x) {
8; CHECK-LABEL: define internal i32 @test(
9; CHECK: i32 %{{.*}})
10entry:
11  %y = load i32*, i32** %x
12  %z = load i32, i32* %y
13; CHECK-NOT: load
14  ret i32 %z
15; CHECK: ret i32
16}
17
18define i32 @caller() {
19; CHECK-LABEL: define i32 @caller()
20entry:
21  %x = call i32 @test(i32** @G2)
22; CHECK: %[[Y:.*]] = load i32*, i32** @G2
23; CHECK: %[[Z:.*]] = load i32, i32* %[[Y]]
24; CHECK: call i32 @test(i32 %[[Z]])
25  ret i32 %x
26}
27
28