brintos

brintos / llvm-project-archived public Read only

0
0
Text · 20.3 KiB · 3afdf94 Raw
366 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=loop-vectorize < %s | FileCheck %s3 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, ptr %array) {8; CHECK-LABEL: @reduction_sum_float_ieee(9; CHECK-NEXT:  entry:10; CHECK-NEXT:    [[ENTRY_COND:%.*]] = icmp ne i32 0, 409611; 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, ptr [[ARRAY:%.*]], i32 [[IDX]]18; CHECK-NEXT:    [[VALUE:%.*]] = load float, ptr [[ADDRESS]], align 419; CHECK-NEXT:    [[SUM_INC]] = fadd float [[SUM]], [[VALUE]]20; CHECK-NEXT:    [[IDX_INC]] = add i32 [[IDX]], 121; CHECK-NEXT:    [[BE_COND:%.*]] = icmp ne i32 [[IDX_INC]], 409622; 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, 409632  br i1 %entry.cond, label %loop, label %loop.exit33 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, ptr %array, i32 %idx38  %value = load float, ptr %address39  %sum.inc = fadd float %sum, %value40  %idx.inc = add i32 %idx, 141  %be.cond = icmp ne i32 %idx.inc, 409642  br i1 %be.cond, label %loop, label %loop.exit43 44loop.exit:45  %sum.lcssa = phi float [ %sum.inc, %loop ], [ 0.000000e+00, %entry ]46  ret float %sum.lcssa47}48 49define float @reduction_sum_float_fastmath(i32 %n, ptr %array) {50; CHECK-LABEL: @reduction_sum_float_fastmath(51; CHECK-NEXT:  entry:52; CHECK-NEXT:    [[ENTRY_COND:%.*]] = icmp ne i32 0, 409653; CHECK-NEXT:    br i1 [[ENTRY_COND]], label [[LOOP_PREHEADER:%.*]], label [[LOOP_EXIT:%.*]]54; CHECK:       loop.preheader:55; CHECK-NEXT:    br 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]] ], [ [[TMP6:%.*]], [[VECTOR_BODY]] ]61; CHECK-NEXT:    [[VEC_PHI1:%.*]] = phi <4 x float> [ zeroinitializer, [[VECTOR_PH]] ], [ [[TMP7:%.*]], [[VECTOR_BODY]] ]62; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr float, ptr [[ARRAY:%.*]], i32 [[INDEX]]63; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr float, ptr [[TMP2]], i64 464; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 465; CHECK-NEXT:    [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP5]], align 466; CHECK-NEXT:    [[TMP6]] = fadd fast <4 x float> [[VEC_PHI]], [[WIDE_LOAD]]67; CHECK-NEXT:    [[TMP7]] = fadd fast <4 x float> [[VEC_PHI1]], [[WIDE_LOAD2]]68; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 869; CHECK-NEXT:    [[TMP8:%.*]] = icmp eq i32 [[INDEX_NEXT]], 409670; CHECK-NEXT:    br i1 [[TMP8]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]71; CHECK:       middle.block:72; CHECK-NEXT:    [[BIN_RDX:%.*]] = fadd fast <4 x float> [[TMP7]], [[TMP6]]73; CHECK-NEXT:    [[TMP9:%.*]] = call fast float @llvm.vector.reduce.fadd.v4f32(float 0.000000e+00, <4 x float> [[BIN_RDX]])74; CHECK-NEXT:    br label [[LOOP:%.*]]75; CHECK:       loop.exit.loopexit:76; CHECK-NEXT:    br label [[LOOP_EXIT]]77; CHECK:       loop.exit:78; CHECK-NEXT:    [[SUM_LCSSA:%.*]] = phi float [ 0.000000e+00, [[ENTRY:%.*]] ], [ [[TMP9]], [[LOOP]] ]79; CHECK-NEXT:    ret float [[SUM_LCSSA]]80;81entry:82  %entry.cond = icmp ne i32 0, 409683  br i1 %entry.cond, label %loop, label %loop.exit84 85loop:86  %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]87  %sum = phi float [ 0.000000e+00, %entry ], [ %sum.inc, %loop ]88  %address = getelementptr float, ptr %array, i32 %idx89  %value = load float, ptr %address90  %sum.inc = fadd fast float %sum, %value91  %idx.inc = add i32 %idx, 192  %be.cond = icmp ne i32 %idx.inc, 409693  br i1 %be.cond, label %loop, label %loop.exit94 95loop.exit:96  %sum.lcssa = phi float [ %sum.inc, %loop ], [ 0.000000e+00, %entry ]97  ret float %sum.lcssa98}99 100define float @reduction_sum_float_only_reassoc(i32 %n, ptr %array) {101; CHECK-LABEL: @reduction_sum_float_only_reassoc(102; CHECK-NEXT:  entry:103; CHECK-NEXT:    [[ENTRY_COND:%.*]] = icmp ne i32 0, 4096104; CHECK-NEXT:    br i1 [[ENTRY_COND]], label [[LOOP_PREHEADER:%.*]], label [[LOOP_EXIT:%.*]]105; CHECK:       loop.preheader:106; CHECK-NEXT:    br label [[VECTOR_PH:%.*]]107; CHECK:       vector.ph:108; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]109; CHECK:       vector.body:110; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]111; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <4 x float> [ splat (float -0.000000e+00), [[VECTOR_PH]] ], [ [[TMP6:%.*]], [[VECTOR_BODY]] ]112; CHECK-NEXT:    [[VEC_PHI1:%.*]] = phi <4 x float> [ splat (float -0.000000e+00), [[VECTOR_PH]] ], [ [[TMP7:%.*]], [[VECTOR_BODY]] ]113; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr float, ptr [[ARRAY:%.*]], i32 [[INDEX]]114; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr float, ptr [[TMP2]], i64 4115; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 4116; CHECK-NEXT:    [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP5]], align 4117; CHECK-NEXT:    [[TMP6]] = fadd reassoc <4 x float> [[VEC_PHI]], [[WIDE_LOAD]]118; CHECK-NEXT:    [[TMP7]] = fadd reassoc <4 x float> [[VEC_PHI1]], [[WIDE_LOAD2]]119; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 8120; CHECK-NEXT:    [[TMP8:%.*]] = icmp eq i32 [[INDEX_NEXT]], 4096121; CHECK-NEXT:    br i1 [[TMP8]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP3:![0-9]+]]122; CHECK:       middle.block:123; CHECK-NEXT:    [[BIN_RDX:%.*]] = fadd reassoc <4 x float> [[TMP7]], [[TMP6]]124; CHECK-NEXT:    [[TMP9:%.*]] = call reassoc float @llvm.vector.reduce.fadd.v4f32(float -0.000000e+00, <4 x float> [[BIN_RDX]])125; CHECK-NEXT:    br label [[LOOP:%.*]]126; CHECK:       loop.exit.loopexit:127; CHECK-NEXT:    br label [[LOOP_EXIT]]128; CHECK:       loop.exit:129; CHECK-NEXT:    [[SUM_LCSSA:%.*]] = phi float [ -0.000000e+00, [[ENTRY:%.*]] ], [ [[TMP9]], [[LOOP]] ]130; CHECK-NEXT:    ret float [[SUM_LCSSA]]131;132entry:133  %entry.cond = icmp ne i32 0, 4096134  br i1 %entry.cond, label %loop, label %loop.exit135 136loop:137  %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]138  %sum = phi float [ -0.000000e+00, %entry ], [ %sum.inc, %loop ]139  %address = getelementptr float, ptr %array, i32 %idx140  %value = load float, ptr %address141  %sum.inc = fadd reassoc float %sum, %value142  %idx.inc = add i32 %idx, 1143  %be.cond = icmp ne i32 %idx.inc, 4096144  br i1 %be.cond, label %loop, label %loop.exit145 146loop.exit:147  %sum.lcssa = phi float [ %sum.inc, %loop ], [ -0.000000e+00, %entry ]148  ret float %sum.lcssa149}150 151define float @reduction_sum_float_only_reassoc_and_contract(i32 %n, ptr %array) {152; CHECK-LABEL: @reduction_sum_float_only_reassoc_and_contract(153; CHECK-NEXT:  entry:154; CHECK-NEXT:    [[ENTRY_COND:%.*]] = icmp ne i32 0, 4096155; CHECK-NEXT:    br i1 [[ENTRY_COND]], label [[LOOP_PREHEADER:%.*]], label [[LOOP_EXIT:%.*]]156; CHECK:       loop.preheader:157; CHECK-NEXT:    br label [[VECTOR_PH:%.*]]158; CHECK:       vector.ph:159; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]160; CHECK:       vector.body:161; CHECK-NEXT:    [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]162; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <4 x float> [ splat (float -0.000000e+00), [[VECTOR_PH]] ], [ [[TMP6:%.*]], [[VECTOR_BODY]] ]163; CHECK-NEXT:    [[VEC_PHI1:%.*]] = phi <4 x float> [ splat (float -0.000000e+00), [[VECTOR_PH]] ], [ [[TMP7:%.*]], [[VECTOR_BODY]] ]164; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr float, ptr [[ARRAY:%.*]], i32 [[INDEX]]165; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr float, ptr [[TMP2]], i64 4166; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 4167; CHECK-NEXT:    [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP5]], align 4168; CHECK-NEXT:    [[TMP6]] = fadd reassoc contract <4 x float> [[VEC_PHI]], [[WIDE_LOAD]]169; CHECK-NEXT:    [[TMP7]] = fadd reassoc contract <4 x float> [[VEC_PHI1]], [[WIDE_LOAD2]]170; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i32 [[INDEX]], 8171; CHECK-NEXT:    [[TMP8:%.*]] = icmp eq i32 [[INDEX_NEXT]], 4096172; CHECK-NEXT:    br i1 [[TMP8]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]173; CHECK:       middle.block:174; CHECK-NEXT:    [[BIN_RDX:%.*]] = fadd reassoc contract <4 x float> [[TMP7]], [[TMP6]]175; CHECK-NEXT:    [[TMP9:%.*]] = call reassoc contract float @llvm.vector.reduce.fadd.v4f32(float -0.000000e+00, <4 x float> [[BIN_RDX]])176; CHECK-NEXT:    br label [[LOOP:%.*]]177; CHECK:       loop.exit.loopexit:178; CHECK-NEXT:    br label [[LOOP_EXIT]]179; CHECK:       loop.exit:180; CHECK-NEXT:    [[SUM_LCSSA:%.*]] = phi float [ -0.000000e+00, [[ENTRY:%.*]] ], [ [[TMP9]], [[LOOP]] ]181; CHECK-NEXT:    ret float [[SUM_LCSSA]]182;183entry:184  %entry.cond = icmp ne i32 0, 4096185  br i1 %entry.cond, label %loop, label %loop.exit186 187loop:188  %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]189  %sum = phi float [ -0.000000e+00, %entry ], [ %sum.inc, %loop ]190  %address = getelementptr float, ptr %array, i32 %idx191  %value = load float, ptr %address192  %sum.inc = fadd reassoc contract float %sum, %value193  %idx.inc = add i32 %idx, 1194  %be.cond = icmp ne i32 %idx.inc, 4096195  br i1 %be.cond, label %loop, label %loop.exit196 197loop.exit:198  %sum.lcssa = phi float [ %sum.inc, %loop ], [ -0.000000e+00, %entry ]199  ret float %sum.lcssa200}201 202; New instructions should have the same FMF as the original code.203; Note that the select inherits FMF from its fcmp condition.204 205define float @PR35538(ptr nocapture readonly %a, i32 %N) #0 {206; CHECK-LABEL: @PR35538(207; CHECK-NEXT:  entry:208; CHECK-NEXT:    [[CMP12:%.*]] = icmp sgt i32 [[N:%.*]], 0209; CHECK-NEXT:    br i1 [[CMP12]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_COND_CLEANUP:%.*]]210; CHECK:       for.body.lr.ph:211; CHECK-NEXT:    [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[N]] to i64212; CHECK-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[WIDE_TRIP_COUNT]], 8213; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]214; CHECK:       vector.ph:215; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[WIDE_TRIP_COUNT]], 8216; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 [[WIDE_TRIP_COUNT]], [[N_MOD_VF]]217; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]218; CHECK:       vector.body:219; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]220; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <4 x float> [ splat (float -1.000000e+00), [[VECTOR_PH]] ], [ [[TMP8:%.*]], [[VECTOR_BODY]] ]221; CHECK-NEXT:    [[VEC_PHI1:%.*]] = phi <4 x float> [ splat (float -1.000000e+00), [[VECTOR_PH]] ], [ [[TMP9:%.*]], [[VECTOR_BODY]] ]222; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 [[INDEX]]223; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr inbounds float, ptr [[TMP2]], i64 4224; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 4225; CHECK-NEXT:    [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP5]], align 4226; CHECK-NEXT:    [[TMP6:%.*]] = fcmp nnan ninf nsz oge <4 x float> [[WIDE_LOAD]], [[VEC_PHI]]227; CHECK-NEXT:    [[TMP7:%.*]] = fcmp nnan ninf nsz oge <4 x float> [[WIDE_LOAD2]], [[VEC_PHI1]]228; CHECK-NEXT:    [[TMP8]] = select <4 x i1> [[TMP6]], <4 x float> [[WIDE_LOAD]], <4 x float> [[VEC_PHI]]229; CHECK-NEXT:    [[TMP9]] = select <4 x i1> [[TMP7]], <4 x float> [[WIDE_LOAD2]], <4 x float> [[VEC_PHI1]]230; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8231; CHECK-NEXT:    [[TMP10:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]232; CHECK-NEXT:    br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP5:![0-9]+]]233; CHECK:       middle.block:234; CHECK-NEXT:    [[RDX_MINMAX_CMP:%.*]] = fcmp nnan ninf nsz ogt <4 x float> [[TMP8]], [[TMP9]]235; CHECK-NEXT:    [[RDX_MINMAX_SELECT:%.*]] = select nnan ninf nsz <4 x i1> [[RDX_MINMAX_CMP]], <4 x float> [[TMP8]], <4 x float> [[TMP9]]236; CHECK-NEXT:    [[TMP11:%.*]] = call nnan ninf nsz float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[RDX_MINMAX_SELECT]])237; CHECK-NEXT:    [[CMP_N:%.*]] = icmp eq i64 [[WIDE_TRIP_COUNT]], [[N_VEC]]238; CHECK-NEXT:    br i1 [[CMP_N]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[SCALAR_PH]]239; CHECK:       scalar.ph:240; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_LR_PH]] ]241; CHECK-NEXT:    [[BC_MERGE_RDX:%.*]] = phi float [ [[TMP11]], [[MIDDLE_BLOCK]] ], [ -1.000000e+00, [[FOR_BODY_LR_PH]] ]242; CHECK-NEXT:    br label [[FOR_BODY:%.*]]243; CHECK:       for.cond.cleanup.loopexit:244; CHECK-NEXT:    [[MAX_0__LCSSA:%.*]] = phi float [ [[MAX_0_:%.*]], [[FOR_BODY]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ]245; CHECK-NEXT:    br label [[FOR_COND_CLEANUP]]246; CHECK:       for.cond.cleanup:247; CHECK-NEXT:    [[MAX_0_LCSSA:%.*]] = phi float [ -1.000000e+00, [[ENTRY:%.*]] ], [ [[MAX_0__LCSSA]], [[FOR_COND_CLEANUP_LOOPEXIT]] ]248; CHECK-NEXT:    ret float [[MAX_0_LCSSA]]249; CHECK:       for.body:250; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]251; CHECK-NEXT:    [[MAX_013:%.*]] = phi float [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ], [ [[MAX_0_]], [[FOR_BODY]] ]252; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVARS_IV]]253; CHECK-NEXT:    [[TMP12:%.*]] = load float, ptr [[ARRAYIDX]], align 4254; CHECK-NEXT:    [[CMP1_INV:%.*]] = fcmp nnan ninf nsz oge float [[TMP12]], [[MAX_013]]255; CHECK-NEXT:    [[MAX_0_]] = select i1 [[CMP1_INV]], float [[TMP12]], float [[MAX_013]]256; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1257; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]258; CHECK-NEXT:    br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]]259;260entry:261  %cmp12 = icmp sgt i32 %N, 0262  br i1 %cmp12, label %for.body.lr.ph, label %for.cond.cleanup263 264for.body.lr.ph:265  %wide.trip.count = zext i32 %N to i64266  br label %for.body267 268for.cond.cleanup:269  %max.0.lcssa = phi float [ -1.000000e+00, %entry ], [ %max.0., %for.body ]270  ret float %max.0.lcssa271 272for.body:273  %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]274  %max.013 = phi float [ -1.000000e+00, %for.body.lr.ph ], [ %max.0., %for.body ]275  %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv276  %0 = load float, ptr %arrayidx, align 4277  %cmp1.inv = fcmp nnan ninf nsz oge float %0, %max.013278  %max.0. = select i1 %cmp1.inv, float %0, float %max.013279  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1280  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count281  br i1 %exitcond, label %for.cond.cleanup, label %for.body282}283 284; Same as above, but this time the select already has matching FMF with its condition.285 286define float @PR35538_more_FMF(ptr nocapture readonly %a, i32 %N) #0 {287; CHECK-LABEL: @PR35538_more_FMF(288; CHECK-NEXT:  entry:289; CHECK-NEXT:    [[CMP12:%.*]] = icmp sgt i32 [[N:%.*]], 0290; CHECK-NEXT:    br i1 [[CMP12]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_COND_CLEANUP:%.*]]291; CHECK:       for.body.lr.ph:292; CHECK-NEXT:    [[WIDE_TRIP_COUNT:%.*]] = zext i32 [[N]] to i64293; CHECK-NEXT:    [[MIN_ITERS_CHECK:%.*]] = icmp ult i64 [[WIDE_TRIP_COUNT]], 8294; CHECK-NEXT:    br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]295; CHECK:       vector.ph:296; CHECK-NEXT:    [[N_MOD_VF:%.*]] = urem i64 [[WIDE_TRIP_COUNT]], 8297; CHECK-NEXT:    [[N_VEC:%.*]] = sub i64 [[WIDE_TRIP_COUNT]], [[N_MOD_VF]]298; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]]299; CHECK:       vector.body:300; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]301; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <4 x float> [ splat (float -1.000000e+00), [[VECTOR_PH]] ], [ [[TMP8:%.*]], [[VECTOR_BODY]] ]302; CHECK-NEXT:    [[VEC_PHI1:%.*]] = phi <4 x float> [ splat (float -1.000000e+00), [[VECTOR_PH]] ], [ [[TMP9:%.*]], [[VECTOR_BODY]] ]303; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 [[INDEX]]304; CHECK-NEXT:    [[TMP5:%.*]] = getelementptr inbounds float, ptr [[TMP2]], i64 4305; CHECK-NEXT:    [[WIDE_LOAD:%.*]] = load <4 x float>, ptr [[TMP2]], align 4306; CHECK-NEXT:    [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP5]], align 4307; CHECK-NEXT:    [[TMP6:%.*]] = fcmp nnan ninf oge <4 x float> [[WIDE_LOAD]], [[VEC_PHI]]308; CHECK-NEXT:    [[TMP7:%.*]] = fcmp nnan ninf oge <4 x float> [[WIDE_LOAD2]], [[VEC_PHI1]]309; CHECK-NEXT:    [[TMP8]] = select nnan ninf <4 x i1> [[TMP6]], <4 x float> [[WIDE_LOAD]], <4 x float> [[VEC_PHI]]310; CHECK-NEXT:    [[TMP9]] = select nnan ninf <4 x i1> [[TMP7]], <4 x float> [[WIDE_LOAD2]], <4 x float> [[VEC_PHI1]]311; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8312; CHECK-NEXT:    [[TMP10:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]313; CHECK-NEXT:    br i1 [[TMP10]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP7:![0-9]+]]314; CHECK:       middle.block:315; CHECK-NEXT:    [[RDX_MINMAX_CMP:%.*]] = fcmp nnan ninf ogt <4 x float> [[TMP8]], [[TMP9]]316; CHECK-NEXT:    [[RDX_MINMAX_SELECT:%.*]] = select nnan ninf <4 x i1> [[RDX_MINMAX_CMP]], <4 x float> [[TMP8]], <4 x float> [[TMP9]]317; CHECK-NEXT:    [[TMP11:%.*]] = call nnan ninf float @llvm.vector.reduce.fmax.v4f32(<4 x float> [[RDX_MINMAX_SELECT]])318; CHECK-NEXT:    [[CMP_N:%.*]] = icmp eq i64 [[WIDE_TRIP_COUNT]], [[N_VEC]]319; CHECK-NEXT:    br i1 [[CMP_N]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]], label [[SCALAR_PH]]320; CHECK:       scalar.ph:321; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i64 [ [[N_VEC]], [[MIDDLE_BLOCK]] ], [ 0, [[FOR_BODY_LR_PH]] ]322; CHECK-NEXT:    [[BC_MERGE_RDX:%.*]] = phi float [ [[TMP11]], [[MIDDLE_BLOCK]] ], [ -1.000000e+00, [[FOR_BODY_LR_PH]] ]323; CHECK-NEXT:    br label [[FOR_BODY:%.*]]324; CHECK:       for.cond.cleanup.loopexit:325; CHECK-NEXT:    [[MAX_0__LCSSA:%.*]] = phi float [ [[MAX_0_:%.*]], [[FOR_BODY]] ], [ [[TMP11]], [[MIDDLE_BLOCK]] ]326; CHECK-NEXT:    br label [[FOR_COND_CLEANUP]]327; CHECK:       for.cond.cleanup:328; CHECK-NEXT:    [[MAX_0_LCSSA:%.*]] = phi float [ -1.000000e+00, [[ENTRY:%.*]] ], [ [[MAX_0__LCSSA]], [[FOR_COND_CLEANUP_LOOPEXIT]] ]329; CHECK-NEXT:    ret float [[MAX_0_LCSSA]]330; CHECK:       for.body:331; CHECK-NEXT:    [[INDVARS_IV:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]332; CHECK-NEXT:    [[MAX_013:%.*]] = phi float [ [[BC_MERGE_RDX]], [[SCALAR_PH]] ], [ [[MAX_0_]], [[FOR_BODY]] ]333; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds float, ptr [[A]], i64 [[INDVARS_IV]]334; CHECK-NEXT:    [[TMP12:%.*]] = load float, ptr [[ARRAYIDX]], align 4335; CHECK-NEXT:    [[CMP1_INV:%.*]] = fcmp nnan ninf oge float [[TMP12]], [[MAX_013]]336; CHECK-NEXT:    [[MAX_0_]] = select nnan ninf i1 [[CMP1_INV]], float [[TMP12]], float [[MAX_013]]337; CHECK-NEXT:    [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1338; CHECK-NEXT:    [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], [[WIDE_TRIP_COUNT]]339; CHECK-NEXT:    br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]340;341entry:342  %cmp12 = icmp sgt i32 %N, 0343  br i1 %cmp12, label %for.body.lr.ph, label %for.cond.cleanup344 345for.body.lr.ph:346  %wide.trip.count = zext i32 %N to i64347  br label %for.body348 349for.cond.cleanup:350  %max.0.lcssa = phi float [ -1.000000e+00, %entry ], [ %max.0., %for.body ]351  ret float %max.0.lcssa352 353for.body:354  %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]355  %max.013 = phi float [ -1.000000e+00, %for.body.lr.ph ], [ %max.0., %for.body ]356  %arrayidx = getelementptr inbounds float, ptr %a, i64 %indvars.iv357  %0 = load float, ptr %arrayidx, align 4358  %cmp1.inv = fcmp nnan ninf oge float %0, %max.013359  %max.0. = select nnan ninf i1 %cmp1.inv, float %0, float %max.013360  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1361  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count362  br i1 %exitcond, label %for.cond.cleanup, label %for.body363}364 365attributes #0 = { "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" }366