blob: f5d261d8afc07a578bb1fca6bd0d0138934d8296 [file] [log] [blame] [edit]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt %s -passes=sroa -S | FileCheck %s
%"struct.pbrt::RaySamples" = type { %struct.anon.45, %struct.anon.46, i8, %struct.anon.47 }
%struct.anon.45 = type { %"class.pbrt::Point2", float }
%"class.pbrt::Point2" = type { %"class.pbrt::Tuple2" }
%"class.pbrt::Tuple2" = type { float, float }
%struct.anon.46 = type { float, float, %"class.pbrt::Point2" }
%struct.anon.47 = type { float, %"class.pbrt::Point2" }
define <2 x float> @subsurface_test() local_unnamed_addr {
; CHECK-LABEL: define <2 x float> @subsurface_test() local_unnamed_addr {
; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr inttoptr (i64 12 to ptr), align 4
; CHECK-NEXT: [[TMP2:%.*]] = fptosi float [[TMP1]] to i32
; CHECK-NEXT: [[TMP3:%.*]] = trunc i32 [[TMP2]] to i1
; CHECK-NEXT: br i1 [[TMP3]], label %[[BB4:.*]], label %[[_ZNK4PBRT3SOAINS_10RAYSAMPLESEEIXEI_EXIT:.*]]
; CHECK: [[BB4]]:
; CHECK-NEXT: [[TMP5:%.*]] = load volatile { <2 x float>, <2 x float> }, ptr null, align 8
; CHECK-NEXT: [[TMP6:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP5]], 0
; CHECK-NEXT: [[TMP7:%.*]] = extractvalue { <2 x float>, <2 x float> } [[TMP5]], 1
; CHECK-NEXT: [[BC_I:%.*]] = bitcast <2 x float> [[TMP6]] to <2 x i32>
; CHECK-NEXT: [[TMP8:%.*]] = extractelement <2 x i32> [[BC_I]], i64 1
; CHECK-NEXT: [[BC2_I:%.*]] = bitcast <2 x float> [[TMP7]] to <2 x i32>
; CHECK-NEXT: [[TMP9:%.*]] = extractelement <2 x i32> [[BC2_I]], i64 0
; CHECK-NEXT: [[TMP12:%.*]] = bitcast i32 [[TMP8]] to float
; CHECK-NEXT: [[DOTSROA_1_36_VEC_INSERT:%.*]] = insertelement <2 x float> zeroinitializer, float [[TMP12]], i32 0
; CHECK-NEXT: [[TMP11:%.*]] = bitcast i32 [[TMP9]] to float
; CHECK-NEXT: [[DOTSROA_1_40_VEC_INSERT:%.*]] = insertelement <2 x float> [[DOTSROA_1_36_VEC_INSERT]], float [[TMP11]], i32 1
; CHECK-NEXT: br label %[[_ZNK4PBRT3SOAINS_10RAYSAMPLESEEIXEI_EXIT]]
; CHECK: [[_ZNK4PBRT3SOAINS_10RAYSAMPLESEEIXEI_EXIT]]:
; CHECK-NEXT: [[TMP10:%.*]] = phi <2 x float> [ [[DOTSROA_1_40_VEC_INSERT]], %[[BB4]] ], [ zeroinitializer, [[TMP0:%.*]] ]
; CHECK-NEXT: ret <2 x float> [[TMP10]]
;
%1 = alloca %"struct.pbrt::RaySamples", align 4
%2 = getelementptr i8, ptr %1, i64 36
store i64 0, ptr %2, align 4
%3 = load float, ptr inttoptr (i64 12 to ptr), align 4
%4 = fptosi float %3 to i32
%5 = trunc i32 %4 to i1
br i1 %5, label %6, label %_ZNK4pbrt3SOAINS_10RaySamplesEEixEi.exit
6: ; preds = %0
%7 = load volatile { <2 x float>, <2 x float> }, ptr null, align 8
%8 = extractvalue { <2 x float>, <2 x float> } %7, 0
%9 = extractvalue { <2 x float>, <2 x float> } %7, 1
store float 0.000000e+00, ptr %1, align 4
%bc.i = bitcast <2 x float> %8 to <2 x i32>
%10 = extractelement <2 x i32> %bc.i, i64 1
%bc2.i = bitcast <2 x float> %9 to <2 x i32>
%11 = extractelement <2 x i32> %bc2.i, i64 0
store i32 %10, ptr %2, align 4
%.sroa_idx1.i = getelementptr i8, ptr %1, i64 40
store i32 %11, ptr %.sroa_idx1.i, align 4
br label %_ZNK4pbrt3SOAINS_10RaySamplesEEixEi.exit
_ZNK4pbrt3SOAINS_10RaySamplesEEixEi.exit: ; preds = %0, %6
%12 = getelementptr inbounds nuw i8, ptr %1, i64 36
%.sroa.01.0.copyload = load <2 x float>, ptr %12, align 4
ret <2 x float> %.sroa.01.0.copyload
}
define void @test_mixed_types() {
; CHECK-LABEL: @test_mixed_types(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[TMP0:%.*]] = bitcast i32 42 to float
; CHECK-NEXT: ret void
;
entry:
%alloca = alloca [2 x half]
store i32 42, ptr %alloca
%val = load float, ptr %alloca
ret void
}