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