Home | History | Annotate | Download | only in Inline
      1 ; RUN: opt < %s -inline -S | FileCheck %s
      2 ; This variant of the test has no data layout information.
      3 target triple = "powerpc64-unknown-linux-gnu"
      4 
      5 %struct.s = type { i32, i32 }
      6 
      7 define void @foo(%struct.s* byval nocapture readonly %a) {
      8 entry:
      9   %x = alloca [2 x i32], align 4
     10   %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
     11   %0 = load i32* %a1, align 4
     12   %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
     13   store i32 %0, i32* %arrayidx, align 4
     14   %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
     15   %1 = load i32* %b, align 4
     16   %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
     17   store i32 %1, i32* %arrayidx2, align 4
     18   call void @bar(i32* %arrayidx) #2
     19   ret void
     20 }
     21 
     22 define void @foo0(%struct.s* byval nocapture readonly %a) {
     23 entry:
     24   %x = alloca [2 x i32]
     25   %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
     26   %0 = load i32* %a1, align 4
     27   %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
     28   store i32 %0, i32* %arrayidx, align 4
     29   %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
     30   %1 = load i32* %b, align 4
     31   %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
     32   store i32 %1, i32* %arrayidx2, align 4
     33   call void @bar(i32* %arrayidx) #2
     34   ret void
     35 }
     36 
     37 declare void @bar(i32*) #1
     38 
     39 define void @goo(%struct.s* byval nocapture readonly %a) {
     40 entry:
     41   %x = alloca [2 x i32], align 32
     42   %a1 = getelementptr inbounds %struct.s* %a, i64 0, i32 0
     43   %0 = load i32* %a1, align 4
     44   %arrayidx = getelementptr inbounds [2 x i32]* %x, i64 0, i64 0
     45   store i32 %0, i32* %arrayidx, align 32
     46   %b = getelementptr inbounds %struct.s* %a, i64 0, i32 1
     47   %1 = load i32* %b, align 4
     48   %arrayidx2 = getelementptr inbounds [2 x i32]* %x, i64 0, i64 1
     49   store i32 %1, i32* %arrayidx2, align 4
     50   call void @bar(i32* %arrayidx) #2
     51   ret void
     52 }
     53 
     54 ; CHECK-LABEL: @main
     55 ; CHECK: alloca [2 x i32], align 32
     56 ; CHECK-NOT: alloca [2 x i32]
     57 ; CHECK: ret i32 0
     58 
     59 define signext i32 @main() {
     60 entry:
     61   %a = alloca i64, align 8
     62   %tmpcast = bitcast i64* %a to %struct.s*
     63   store i64 0, i64* %a, align 8
     64   %a1 = bitcast i64* %a to i32*
     65   store i32 1, i32* %a1, align 8
     66   call void @foo(%struct.s* byval %tmpcast)
     67   store i32 2, i32* %a1, align 8
     68   call void @goo(%struct.s* byval %tmpcast)
     69   ret i32 0
     70 }
     71 
     72 ; CHECK-LABEL: @test0
     73 ; CHECK: alloca [2 x i32], align 32
     74 ; CHECK: alloca [2 x i32]
     75 ; CHECK: ret i32 0
     76 
     77 define signext i32 @test0() {
     78 entry:
     79   %a = alloca i64, align 8
     80   %tmpcast = bitcast i64* %a to %struct.s*
     81   store i64 0, i64* %a, align 8
     82   %a1 = bitcast i64* %a to i32*
     83   store i32 1, i32* %a1, align 8
     84   call void @foo0(%struct.s* byval %tmpcast)
     85   store i32 2, i32* %a1, align 8
     86   call void @goo(%struct.s* byval %tmpcast)
     87   ret i32 0
     88 }
     89