Home | History | Annotate | Download | only in ArgumentPromotion
      1 ; RUN: opt < %s -argpromotion -S | FileCheck %s
      2 ; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
      3 
      4 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
      5 target triple = "x86_64-pc-windows-msvc"
      6 
      7 ; CHECK: define internal void @add(i32 %[[THIS1:.*]], i32 %[[THIS2:.*]], i32* noalias %[[SR:.*]])
      8 define internal void @add({i32, i32}* %this, i32* sret %r) {
      9   %ap = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 0
     10   %bp = getelementptr {i32, i32}, {i32, i32}* %this, i32 0, i32 1
     11   %a = load i32, i32* %ap
     12   %b = load i32, i32* %bp
     13   ; CHECK: %[[AB:.*]] = add i32 %[[THIS1]], %[[THIS2]]
     14   %ab = add i32 %a, %b
     15   ; CHECK: store i32 %[[AB]], i32* %[[SR]]
     16   store i32 %ab, i32* %r
     17   ret void
     18 }
     19 
     20 ; CHECK: define void @f()
     21 define void @f() {
     22   ; CHECK: %[[R:.*]] = alloca i32
     23   %r = alloca i32
     24   %pair = alloca {i32, i32}
     25 
     26   ; CHECK: call void @add(i32 %{{.*}}, i32 %{{.*}}, i32* noalias %[[R]])
     27   call void @add({i32, i32}* %pair, i32* sret %r)
     28   ret void
     29 }
     30