• 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; Arg promotion eliminates the struct argument.
5; FIXME: Should it eliminate the i32* argument?
6
7%struct.ss = type { i32, i64 }
8
9define internal void @f(%struct.ss* byval  %b, i32* byval %X) nounwind  {
10; CHECK-LABEL: define internal void @f(i32 %b.0, i64 %b.1, i32* byval %X)
11entry:
12  %tmp = getelementptr %struct.ss, %struct.ss* %b, i32 0, i32 0
13  %tmp1 = load i32, i32* %tmp, align 4
14  %tmp2 = add i32 %tmp1, 1
15  store i32 %tmp2, i32* %tmp, align 4
16
17  store i32 0, i32* %X
18  ret void
19}
20
21define i32 @test(i32* %X) {
22; CHECK-LABEL: define i32 @test
23entry:
24  %S = alloca %struct.ss
25  %tmp1 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 0
26  store i32 1, i32* %tmp1, align 8
27  %tmp4 = getelementptr %struct.ss, %struct.ss* %S, i32 0, i32 1
28  store i64 2, i64* %tmp4, align 4
29  call void @f( %struct.ss* byval %S, i32* byval %X)
30; CHECK: call void @f(i32 %{{.*}}, i64 %{{.*}}, i32* byval %{{.*}})
31  ret i32 0
32}
33