Home | History | Annotate | Download | only in SROA
      1 ; RUN: opt < %s -sroa -S | FileCheck %s
      2 ; RUN: opt < %s -sroa -force-ssa-updater -S | FileCheck %s
      3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
      4 
      5 define { i32, i32 } @test0(i32 %x, i32 %y) {
      6 ; CHECK-LABEL: @test0(
      7 ; CHECK-NOT: alloca
      8 ; CHECK: insertvalue { i32, i32 }
      9 ; CHECK: insertvalue { i32, i32 }
     10 ; CHECK: ret { i32, i32 }
     11 
     12 entry:
     13   %a = alloca { i32, i32 }
     14 
     15   store { i32, i32 } undef, { i32, i32 }* %a
     16 
     17   %gep1 = getelementptr inbounds { i32, i32 }* %a, i32 0, i32 0
     18   store i32 %x, i32* %gep1
     19   %gep2 = getelementptr inbounds { i32, i32 }* %a, i32 0, i32 1
     20   store i32 %y, i32* %gep2
     21 
     22   %result = load { i32, i32 }* %a
     23   ret { i32, i32 } %result
     24 }
     25 
     26 define { i32, i32 } @test1(i32 %x, i32 %y) {
     27 ; FIXME: This may be too conservative. Duncan argues that we are allowed to
     28 ; split the volatile load and store here but must produce volatile scalar loads
     29 ; and stores from them.
     30 ; CHECK-LABEL: @test1(
     31 ; CHECK: alloca
     32 ; CHECK: alloca
     33 ; CHECK: load volatile { i32, i32 }*
     34 ; CHECK: store volatile { i32, i32 }
     35 ; CHECK: ret { i32, i32 }
     36 
     37 entry:
     38   %a = alloca { i32, i32 }
     39   %b = alloca { i32, i32 }
     40 
     41   %gep1 = getelementptr inbounds { i32, i32 }* %a, i32 0, i32 0
     42   store i32 %x, i32* %gep1
     43   %gep2 = getelementptr inbounds { i32, i32 }* %a, i32 0, i32 1
     44   store i32 %y, i32* %gep2
     45 
     46   %result = load volatile { i32, i32 }* %a
     47   store volatile { i32, i32 } %result, { i32, i32 }* %b
     48   ret { i32, i32 } %result
     49 }
     50