1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -loop-vectorize < %s | FileCheck %s 3 4target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 5target triple = "x86_64-unknown-linux-gnu" 6 7define float @reduction_sum_float_ieee(i32 %n, float* %array) { 8; CHECK-LABEL: @reduction_sum_float_ieee( 9; CHECK-NEXT: entry: 10; CHECK-NEXT: [[ENTRY_COND:%.*]] = icmp ne i32 0, 4096 11; CHECK-NEXT: br i1 [[ENTRY_COND]], label [[LOOP_PREHEADER:%.*]], label [[LOOP_EXIT:%.*]] 12; CHECK: loop.preheader: 13; CHECK-NEXT: br label [[LOOP:%.*]] 14; CHECK: loop: 15; CHECK-NEXT: [[IDX:%.*]] = phi i32 [ [[IDX_INC:%.*]], [[LOOP]] ], [ 0, [[LOOP_PREHEADER]] ] 16; CHECK-NEXT: [[SUM:%.*]] = phi float [ [[SUM_INC:%.*]], [[LOOP]] ], [ 0.000000e+00, [[LOOP_PREHEADER]] ] 17; CHECK-NEXT: [[ADDRESS:%.*]] = getelementptr float, float* [[ARRAY:%.*]], i32 [[IDX]] 18; CHECK-NEXT: [[VALUE:%.*]] = load float, float* [[ADDRESS]], align 4 19; CHECK-NEXT: [[SUM_INC]] = fadd float [[SUM]], [[VALUE]] 20; CHECK-NEXT: [[IDX_INC]] = add i32 [[IDX]], 1 21; CHECK-NEXT: [[BE_COND:%.*]] = icmp ne i32 [[IDX_INC]], 4096 22; CHECK-NEXT: br i1 [[BE_COND]], label [[LOOP]], label [[LOOP_EXIT_LOOPEXIT:%.*]] 23; CHECK: loop.exit.loopexit: 24; CHECK-NEXT: [[SUM_INC_LCSSA:%.*]] = phi float [ [[SUM_INC]], [[LOOP]] ] 25; CHECK-NEXT: br label [[LOOP_EXIT]] 26; CHECK: loop.exit: 27; CHECK-NEXT: [[SUM_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[SUM_INC_LCSSA]], [[LOOP_EXIT_LOOPEXIT]] ] 28; CHECK-NEXT: ret float [[SUM_LCSSA]] 29; 30entry: 31 %entry.cond = icmp ne i32 0, 4096 32 br i1 %entry.cond, label %loop, label %loop.exit 33 34loop: 35 %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] 36 %sum = phi float [ 0.000000e+00, %entry ], [ %sum.inc, %loop ] 37 %address = getelementptr float, float* %array, i32 %idx 38 %value = load float, float* %address 39 %sum.inc = fadd float %sum, %value 40 %idx.inc = add i32 %idx, 1 41 %be.cond = icmp ne i32 %idx.inc, 4096 42 br i1 %be.cond, label %loop, label %loop.exit 43 44loop.exit: 45 %sum.lcssa = phi float [ %sum.inc, %loop ], [ 0.000000e+00, %entry ] 46 ret float %sum.lcssa 47} 48 49define float @reduction_sum_float_fastmath(i32 %n, float* %array) { 50; CHECK-LABEL: @reduction_sum_float_fastmath( 51; CHECK-NEXT: entry: 52; CHECK-NEXT: [[ENTRY_COND:%.*]] = icmp ne i32 0, 4096 53; CHECK-NEXT: br i1 [[ENTRY_COND]], label [[LOOP_PREHEADER:%.*]], label [[LOOP_EXIT:%.*]] 54; CHECK: loop.preheader: 55; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 56; CHECK: vector.ph: 57; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 58; CHECK: vector.body: 59; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 60; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x float> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP8:%.*]], [[VECTOR_BODY]] ] 61; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x float> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP9:%.*]], [[VECTOR_BODY]] ] 62; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0 63; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[INDEX]], 4 64; CHECK-NEXT: [[TMP2:%.*]] = getelementptr float, float* [[ARRAY:%.*]], i32 [[TMP0]] 65; CHECK-NEXT: [[TMP3:%.*]] = getelementptr float, float* [[ARRAY]], i32 [[TMP1]] 66; CHECK-NEXT: [[TMP4:%.*]] = getelementptr float, float* [[TMP2]], i32 0 67; CHECK-NEXT: [[TMP5:%.*]] = bitcast float* [[TMP4]] to <4 x float>* 68; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, <4 x float>* [[TMP5]], align 4 69; CHECK-NEXT: [[TMP6:%.*]] = getelementptr float, float* [[TMP2]], i32 4 70; CHECK-NEXT: [[TMP7:%.*]] = bitcast float* [[TMP6]] to <4 x float>* 71; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x float>, <4 x float>* [[TMP7]], align 4 72; CHECK-NEXT: [[TMP8]] = fadd fast <4 x float> [[VEC_PHI]], [[WIDE_LOAD]] 73; CHECK-NEXT: [[TMP9]] = fadd fast <4 x float> [[VEC_PHI1]], [[WIDE_LOAD2]] 74; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 8 75; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i32 [[INDEX_NEXT]], 4096 76; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop !0 77; CHECK: middle.block: 78; CHECK-NEXT: [[BIN_RDX:%.*]] = fadd fast <4 x float> [[TMP9]], [[TMP8]] 79; CHECK-NEXT: [[RDX_SHUF:%.*]] = shufflevector <4 x float> [[BIN_RDX]], <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef> 80; CHECK-NEXT: [[BIN_RDX3:%.*]] = fadd fast <4 x float> [[BIN_RDX]], [[RDX_SHUF]] 81; CHECK-NEXT: [[RDX_SHUF4:%.*]] = shufflevector <4 x float> [[BIN_RDX3]], <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> 82; CHECK-NEXT: [[BIN_RDX5:%.*]] = fadd fast <4 x float> [[BIN_RDX3]], [[RDX_SHUF4]] 83; CHECK-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[BIN_RDX5]], i32 0 84; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 4096, 4096 85; CHECK-NEXT: br i1 [[CMP_N]], label [[LOOP_EXIT_LOOPEXIT:%.*]], label [[SCALAR_PH]] 86; CHECK: scalar.ph: 87; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 4096, [[MIDDLE_BLOCK]] ], [ 0, [[LOOP_PREHEADER]] ] 88; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi float [ 0.000000e+00, [[LOOP_PREHEADER]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ] 89; CHECK-NEXT: br label [[LOOP:%.*]] 90; CHECK: loop: 91; CHECK-NEXT: [[IDX:%.*]] = phi i32 [ [[IDX_INC:%.*]], [[LOOP]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ] 92; CHECK-NEXT: [[SUM:%.*]] = phi float [ [[SUM_INC:%.*]], [[LOOP]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ] 93; CHECK-NEXT: [[ADDRESS:%.*]] = getelementptr float, float* [[ARRAY]], i32 [[IDX]] 94; CHECK-NEXT: [[VALUE:%.*]] = load float, float* [[ADDRESS]], align 4 95; CHECK-NEXT: [[SUM_INC]] = fadd fast float [[SUM]], [[VALUE]] 96; CHECK-NEXT: [[IDX_INC]] = add i32 [[IDX]], 1 97; CHECK-NEXT: [[BE_COND:%.*]] = icmp ne i32 [[IDX_INC]], 4096 98; CHECK-NEXT: br i1 [[BE_COND]], label [[LOOP]], label [[LOOP_EXIT_LOOPEXIT]], !llvm.loop !2 99; CHECK: loop.exit.loopexit: 100; CHECK-NEXT: [[SUM_INC_LCSSA:%.*]] = phi float [ [[SUM_INC]], [[LOOP]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ] 101; CHECK-NEXT: br label [[LOOP_EXIT]] 102; CHECK: loop.exit: 103; CHECK-NEXT: [[SUM_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[SUM_INC_LCSSA]], [[LOOP_EXIT_LOOPEXIT]] ] 104; CHECK-NEXT: ret float [[SUM_LCSSA]] 105; 106entry: 107 %entry.cond = icmp ne i32 0, 4096 108 br i1 %entry.cond, label %loop, label %loop.exit 109 110loop: 111 %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] 112 %sum = phi float [ 0.000000e+00, %entry ], [ %sum.inc, %loop ] 113 %address = getelementptr float, float* %array, i32 %idx 114 %value = load float, float* %address 115 %sum.inc = fadd fast float %sum, %value 116 %idx.inc = add i32 %idx, 1 117 %be.cond = icmp ne i32 %idx.inc, 4096 118 br i1 %be.cond, label %loop, label %loop.exit 119 120loop.exit: 121 %sum.lcssa = phi float [ %sum.inc, %loop ], [ 0.000000e+00, %entry ] 122 ret float %sum.lcssa 123} 124 125define float @reduction_sum_float_only_reassoc(i32 %n, float* %array) { 126; CHECK-LABEL: @reduction_sum_float_only_reassoc( 127; CHECK-NEXT: entry: 128; CHECK-NEXT: [[ENTRY_COND:%.*]] = icmp ne i32 0, 4096 129; CHECK-NEXT: br i1 [[ENTRY_COND]], label [[LOOP_PREHEADER:%.*]], label [[LOOP_EXIT:%.*]] 130; CHECK: loop.preheader: 131; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 132; CHECK: vector.ph: 133; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 134; CHECK: vector.body: 135; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 136; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x float> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP8:%.*]], [[VECTOR_BODY]] ] 137; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x float> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP9:%.*]], [[VECTOR_BODY]] ] 138; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0 139; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[INDEX]], 4 140; CHECK-NEXT: [[TMP2:%.*]] = getelementptr float, float* [[ARRAY:%.*]], i32 [[TMP0]] 141; CHECK-NEXT: [[TMP3:%.*]] = getelementptr float, float* [[ARRAY]], i32 [[TMP1]] 142; CHECK-NEXT: [[TMP4:%.*]] = getelementptr float, float* [[TMP2]], i32 0 143; CHECK-NEXT: [[TMP5:%.*]] = bitcast float* [[TMP4]] to <4 x float>* 144; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, <4 x float>* [[TMP5]], align 4 145; CHECK-NEXT: [[TMP6:%.*]] = getelementptr float, float* [[TMP2]], i32 4 146; CHECK-NEXT: [[TMP7:%.*]] = bitcast float* [[TMP6]] to <4 x float>* 147; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x float>, <4 x float>* [[TMP7]], align 4 148; CHECK-NEXT: [[TMP8]] = fadd reassoc <4 x float> [[VEC_PHI]], [[WIDE_LOAD]] 149; CHECK-NEXT: [[TMP9]] = fadd reassoc <4 x float> [[VEC_PHI1]], [[WIDE_LOAD2]] 150; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 8 151; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i32 [[INDEX_NEXT]], 4096 152; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop !4 153; CHECK: middle.block: 154; CHECK-NEXT: [[BIN_RDX:%.*]] = fadd reassoc <4 x float> [[TMP9]], [[TMP8]] 155; CHECK-NEXT: [[RDX_SHUF:%.*]] = shufflevector <4 x float> [[BIN_RDX]], <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef> 156; CHECK-NEXT: [[BIN_RDX3:%.*]] = fadd reassoc <4 x float> [[BIN_RDX]], [[RDX_SHUF]] 157; CHECK-NEXT: [[RDX_SHUF4:%.*]] = shufflevector <4 x float> [[BIN_RDX3]], <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> 158; CHECK-NEXT: [[BIN_RDX5:%.*]] = fadd reassoc <4 x float> [[BIN_RDX3]], [[RDX_SHUF4]] 159; CHECK-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[BIN_RDX5]], i32 0 160; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 4096, 4096 161; CHECK-NEXT: br i1 [[CMP_N]], label [[LOOP_EXIT_LOOPEXIT:%.*]], label [[SCALAR_PH]] 162; CHECK: scalar.ph: 163; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 4096, [[MIDDLE_BLOCK]] ], [ 0, [[LOOP_PREHEADER]] ] 164; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi float [ 0.000000e+00, [[LOOP_PREHEADER]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ] 165; CHECK-NEXT: br label [[LOOP:%.*]] 166; CHECK: loop: 167; CHECK-NEXT: [[IDX:%.*]] = phi i32 [ [[IDX_INC:%.*]], [[LOOP]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ] 168; CHECK-NEXT: [[SUM:%.*]] = phi float [ [[SUM_INC:%.*]], [[LOOP]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ] 169; CHECK-NEXT: [[ADDRESS:%.*]] = getelementptr float, float* [[ARRAY]], i32 [[IDX]] 170; CHECK-NEXT: [[VALUE:%.*]] = load float, float* [[ADDRESS]], align 4 171; CHECK-NEXT: [[SUM_INC]] = fadd reassoc float [[SUM]], [[VALUE]] 172; CHECK-NEXT: [[IDX_INC]] = add i32 [[IDX]], 1 173; CHECK-NEXT: [[BE_COND:%.*]] = icmp ne i32 [[IDX_INC]], 4096 174; CHECK-NEXT: br i1 [[BE_COND]], label [[LOOP]], label [[LOOP_EXIT_LOOPEXIT]], !llvm.loop !5 175; CHECK: loop.exit.loopexit: 176; CHECK-NEXT: [[SUM_INC_LCSSA:%.*]] = phi float [ [[SUM_INC]], [[LOOP]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ] 177; CHECK-NEXT: br label [[LOOP_EXIT]] 178; CHECK: loop.exit: 179; CHECK-NEXT: [[SUM_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[SUM_INC_LCSSA]], [[LOOP_EXIT_LOOPEXIT]] ] 180; CHECK-NEXT: ret float [[SUM_LCSSA]] 181; 182entry: 183 %entry.cond = icmp ne i32 0, 4096 184 br i1 %entry.cond, label %loop, label %loop.exit 185 186loop: 187 %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] 188 %sum = phi float [ 0.000000e+00, %entry ], [ %sum.inc, %loop ] 189 %address = getelementptr float, float* %array, i32 %idx 190 %value = load float, float* %address 191 %sum.inc = fadd reassoc float %sum, %value 192 %idx.inc = add i32 %idx, 1 193 %be.cond = icmp ne i32 %idx.inc, 4096 194 br i1 %be.cond, label %loop, label %loop.exit 195 196loop.exit: 197 %sum.lcssa = phi float [ %sum.inc, %loop ], [ 0.000000e+00, %entry ] 198 ret float %sum.lcssa 199} 200 201define float @reduction_sum_float_only_reassoc_and_contract(i32 %n, float* %array) { 202; CHECK-LABEL: @reduction_sum_float_only_reassoc_and_contract( 203; CHECK-NEXT: entry: 204; CHECK-NEXT: [[ENTRY_COND:%.*]] = icmp ne i32 0, 4096 205; CHECK-NEXT: br i1 [[ENTRY_COND]], label [[LOOP_PREHEADER:%.*]], label [[LOOP_EXIT:%.*]] 206; CHECK: loop.preheader: 207; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]] 208; CHECK: vector.ph: 209; CHECK-NEXT: br label [[VECTOR_BODY:%.*]] 210; CHECK: vector.body: 211; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] 212; CHECK-NEXT: [[VEC_PHI:%.*]] = phi <4 x float> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP8:%.*]], [[VECTOR_BODY]] ] 213; CHECK-NEXT: [[VEC_PHI1:%.*]] = phi <4 x float> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP9:%.*]], [[VECTOR_BODY]] ] 214; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[INDEX]], 0 215; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[INDEX]], 4 216; CHECK-NEXT: [[TMP2:%.*]] = getelementptr float, float* [[ARRAY:%.*]], i32 [[TMP0]] 217; CHECK-NEXT: [[TMP3:%.*]] = getelementptr float, float* [[ARRAY]], i32 [[TMP1]] 218; CHECK-NEXT: [[TMP4:%.*]] = getelementptr float, float* [[TMP2]], i32 0 219; CHECK-NEXT: [[TMP5:%.*]] = bitcast float* [[TMP4]] to <4 x float>* 220; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x float>, <4 x float>* [[TMP5]], align 4 221; CHECK-NEXT: [[TMP6:%.*]] = getelementptr float, float* [[TMP2]], i32 4 222; CHECK-NEXT: [[TMP7:%.*]] = bitcast float* [[TMP6]] to <4 x float>* 223; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x float>, <4 x float>* [[TMP7]], align 4 224; CHECK-NEXT: [[TMP8]] = fadd reassoc contract <4 x float> [[VEC_PHI]], [[WIDE_LOAD]] 225; CHECK-NEXT: [[TMP9]] = fadd reassoc contract <4 x float> [[VEC_PHI1]], [[WIDE_LOAD2]] 226; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 8 227; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i32 [[INDEX_NEXT]], 4096 228; CHECK-NEXT: br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop !6 229; CHECK: middle.block: 230; CHECK-NEXT: [[BIN_RDX:%.*]] = fadd reassoc contract <4 x float> [[TMP9]], [[TMP8]] 231; CHECK-NEXT: [[RDX_SHUF:%.*]] = shufflevector <4 x float> [[BIN_RDX]], <4 x float> undef, <4 x i32> <i32 2, i32 3, i32 undef, i32 undef> 232; CHECK-NEXT: [[BIN_RDX3:%.*]] = fadd reassoc contract <4 x float> [[BIN_RDX]], [[RDX_SHUF]] 233; CHECK-NEXT: [[RDX_SHUF4:%.*]] = shufflevector <4 x float> [[BIN_RDX3]], <4 x float> undef, <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef> 234; CHECK-NEXT: [[BIN_RDX5:%.*]] = fadd reassoc contract <4 x float> [[BIN_RDX3]], [[RDX_SHUF4]] 235; CHECK-NEXT: [[TMP11:%.*]] = extractelement <4 x float> [[BIN_RDX5]], i32 0 236; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 4096, 4096 237; CHECK-NEXT: br i1 [[CMP_N]], label [[LOOP_EXIT_LOOPEXIT:%.*]], label [[SCALAR_PH]] 238; CHECK: scalar.ph: 239; CHECK-NEXT: [[BC_RESUME_VAL:%.*]] = phi i32 [ 4096, [[MIDDLE_BLOCK]] ], [ 0, [[LOOP_PREHEADER]] ] 240; CHECK-NEXT: [[BC_MERGE_RDX:%.*]] = phi float [ 0.000000e+00, [[LOOP_PREHEADER]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ] 241; CHECK-NEXT: br label [[LOOP:%.*]] 242; CHECK: loop: 243; CHECK-NEXT: [[IDX:%.*]] = phi i32 [ [[IDX_INC:%.*]], [[LOOP]] ], [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ] 244; CHECK-NEXT: [[SUM:%.*]] = phi float [ [[SUM_INC:%.*]], [[LOOP]] ], [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ] 245; CHECK-NEXT: [[ADDRESS:%.*]] = getelementptr float, float* [[ARRAY]], i32 [[IDX]] 246; CHECK-NEXT: [[VALUE:%.*]] = load float, float* [[ADDRESS]], align 4 247; CHECK-NEXT: [[SUM_INC]] = fadd reassoc contract float [[SUM]], [[VALUE]] 248; CHECK-NEXT: [[IDX_INC]] = add i32 [[IDX]], 1 249; CHECK-NEXT: [[BE_COND:%.*]] = icmp ne i32 [[IDX_INC]], 4096 250; CHECK-NEXT: br i1 [[BE_COND]], label [[LOOP]], label [[LOOP_EXIT_LOOPEXIT]], !llvm.loop !7 251; CHECK: loop.exit.loopexit: 252; CHECK-NEXT: [[SUM_INC_LCSSA:%.*]] = phi float [ [[SUM_INC]], [[LOOP]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ] 253; CHECK-NEXT: br label [[LOOP_EXIT]] 254; CHECK: loop.exit: 255; CHECK-NEXT: [[SUM_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[SUM_INC_LCSSA]], [[LOOP_EXIT_LOOPEXIT]] ] 256; CHECK-NEXT: ret float [[SUM_LCSSA]] 257; 258entry: 259 %entry.cond = icmp ne i32 0, 4096 260 br i1 %entry.cond, label %loop, label %loop.exit 261 262loop: 263 %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ] 264 %sum = phi float [ 0.000000e+00, %entry ], [ %sum.inc, %loop ] 265 %address = getelementptr float, float* %array, i32 %idx 266 %value = load float, float* %address 267 %sum.inc = fadd reassoc contract float %sum, %value 268 %idx.inc = add i32 %idx, 1 269 %be.cond = icmp ne i32 %idx.inc, 4096 270 br i1 %be.cond, label %loop, label %loop.exit 271 272loop.exit: 273 %sum.lcssa = phi float [ %sum.inc, %loop ], [ 0.000000e+00, %entry ] 274 ret float %sum.lcssa 275} 276