https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/235022
Some extract-lane combines can't be performed before unrolling, e.g. the one that combines it to Instruction::ExtractElement can end up extracting from a different part. But the extract-lane(0, canWideIV) combine can because at index 0 you're always extracting from the first part. Do this before unrolling, which improves codegen of unrolled code. --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> >From e5f59b5d880001e5ee48417b54400f872a149529 Mon Sep 17 00:00:00 2001 From: Luke Lau <[email protected]> Date: Fri, 23 Oct 2026 20:43:23 +0800 Subject: [PATCH] [VPlan] Move extract-lane(0, canWideIV) combine before unrolling Some extract-lane combines can't be performed before unrolling, e.g. the one that combines it to Instruction::ExtractElement can end up extracting from a different part. But the extract-lane(0, canWideIV) can because at index 0 you're always extracting from the first part. Do this before unrolling, which improves codegen of unrolled code. --- .../Transforms/Vectorize/VPlanTransforms.cpp | 12 +-- .../AArch64/early_exit_with_stores.ll | 85 ++----------------- .../VPlan/early_exit_with_stores_vplan.ll | 40 ++++----- .../interleave_uncountable_exits.ll | 8 +- ...ountable-and-uncountable-exits-combined.ll | 9 +- 5 files changed, 29 insertions(+), 125 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp index 3dfdddbb91d57..e2ffad9a21782 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp @@ -1385,6 +1385,12 @@ static VPValue *simplifyRecipe(VPlan &Plan, VPSingleDefRecipe *Def) { A->getScalarType() == Def->getScalarType()) return A; + // Replace extract-lane(0, canonical-WIDEN-INDUCTION) with the region's + // scalar canonical IV. + VPWidenIntOrFpInductionRecipe *WidenIV; + if (match(Def, m_ExtractLane(m_ZeroInt(), m_CanonicalWidenIV(WidenIV)))) + return WidenIV->getRegion()->getCanonicalIV(); + // Some simplifications can only be applied after unrolling. Perform them // below. if (!Plan.isUnrolled()) @@ -1396,12 +1402,6 @@ static VPValue *simplifyRecipe(VPlan &Plan, VPSingleDefRecipe *Def) { vputils::isSingleScalar(Def->getOperand(1))) return Def->getOperand(1); - // Replace extract-lane(0, canonical-WIDEN-INDUCTION) with the region's - // scalar canonical IV. - VPWidenIntOrFpInductionRecipe *WidenIV; - if (match(Def, m_ExtractLane(m_ZeroInt(), m_CanonicalWidenIV(WidenIV)))) - return WidenIV->getRegion()->getCanonicalIV(); - // Simplify unrolled VectorPointer without offset, or with zero offset, to // just the pointer operand. if (auto *VPR = dyn_cast<VPVectorPointerRecipe>(Def)) diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/early_exit_with_stores.ll b/llvm/test/Transforms/LoopVectorize/AArch64/early_exit_with_stores.ll index 5064e4197e502..3bdb9fa5d99c5 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/early_exit_with_stores.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/early_exit_with_stores.ll @@ -59,16 +59,11 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]] ; CHECK: [[VECTOR_PH]]: ; CHECK-NEXT: [[TMP2:%.*]] = shl nuw i64 [[TMP0]], 2 -; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i64> poison, i64 [[TMP2]], i64 0 -; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 20, [[TMP1]] ; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 20, [[N_MOD_VF]] -; CHECK-NEXT: [[TMP17:%.*]] = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64() ; CHECK-NEXT: br label %[[FOR_BODY1:.*]] ; CHECK: [[FOR_BODY1]]: ; CHECK-NEXT: [[IV1:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[FOR_BODY1]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <vscale x 4 x i64> [ [[TMP17]], %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[FOR_BODY1]] ] -; CHECK-NEXT: [[STEP_ADD:%.*]] = add nuw <vscale x 4 x i64> [[VEC_IND]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw i16, ptr [[PRED]], i64 [[IV1]] ; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds nuw i16, ptr [[TMP5]], i64 [[TMP2]] ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <vscale x 4 x i16>, ptr [[TMP5]], align 2 @@ -96,7 +91,6 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-NEXT: [[TMP10:%.*]] = call i1 @llvm.vector.reduce.or.nxv4i1(<vscale x 4 x i1> [[TMP16]]) ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[IV1]], [[TMP1]] ; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <vscale x 4 x i64> [[STEP_ADD]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP12:%.*]] = or i1 [[TMP10]], [[TMP11]] ; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[FOR_BODY1]], !llvm.loop [[LOOP0:![0-9]+]] ; CHECK: [[MIDDLE_BLOCK]]: @@ -110,16 +104,7 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-NEXT: [[TMP27:%.*]] = add i64 [[TMP26]], [[TMP7]] ; CHECK-NEXT: [[TMP28:%.*]] = icmp ne i64 [[TMP7]], [[TMP21]] ; CHECK-NEXT: [[TMP29:%.*]] = select i1 [[TMP28]], i64 [[TMP27]], i64 [[TMP24]] -; CHECK-NEXT: [[TMP40:%.*]] = call i64 @llvm.vscale.i64() -; CHECK-NEXT: [[TMP41:%.*]] = mul nuw i64 [[TMP40]], 4 -; CHECK-NEXT: [[TMP33:%.*]] = mul i64 [[TMP41]], 0 -; CHECK-NEXT: [[TMP34:%.*]] = extractelement <vscale x 4 x i64> [[VEC_IND]], i64 0 -; CHECK-NEXT: [[TMP35:%.*]] = mul i64 [[TMP41]], 1 -; CHECK-NEXT: [[TMP36:%.*]] = sub i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP37:%.*]] = extractelement <vscale x 4 x i64> [[STEP_ADD]], i64 [[TMP36]] -; CHECK-NEXT: [[TMP38:%.*]] = icmp uge i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP39:%.*]] = select i1 [[TMP38]], i64 [[TMP37]], i64 [[TMP34]] -; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[TMP39]], [[TMP29]] +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[IV1]], [[TMP29]] ; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i64 [[TMP13]], 20 ; CHECK-NEXT: br i1 [[TMP14]], label %[[EXIT:.*]], label %[[SCALAR_PH]] ; CHECK: [[SCALAR_PH]]: @@ -175,16 +160,11 @@ define void @loop_contains_store_fcmp_condition(ptr dereferenceable(40) noalias ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]] ; CHECK: [[VECTOR_PH]]: ; CHECK-NEXT: [[TMP14:%.*]] = shl nuw i64 [[TMP0]], 2 -; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i64> poison, i64 [[TMP14]], i64 0 -; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 20, [[TMP1]] ; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 20, [[N_MOD_VF]] -; CHECK-NEXT: [[TMP17:%.*]] = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64() ; CHECK-NEXT: br label %[[FOR_BODY:.*]] ; CHECK: [[FOR_BODY]]: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[FOR_BODY]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <vscale x 4 x i64> [ [[TMP17]], %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[FOR_BODY]] ] -; CHECK-NEXT: [[STEP_ADD:%.*]] = add nuw <vscale x 4 x i64> [[VEC_IND]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw half, ptr [[PRED]], i64 [[INDEX]] ; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds nuw half, ptr [[TMP2]], i64 [[TMP14]] ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <vscale x 4 x half>, ptr [[TMP2]], align 2 @@ -212,7 +192,6 @@ define void @loop_contains_store_fcmp_condition(ptr dereferenceable(40) noalias ; CHECK-NEXT: [[TMP8:%.*]] = call i1 @llvm.vector.reduce.or.nxv4i1(<vscale x 4 x i1> [[TMP16]]) ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], [[TMP1]] ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <vscale x 4 x i64> [[STEP_ADD]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP10:%.*]] = or i1 [[TMP8]], [[TMP9]] ; CHECK-NEXT: br i1 [[TMP10]], label %[[MIDDLE_BLOCK:.*]], label %[[FOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]] ; CHECK: [[MIDDLE_BLOCK]]: @@ -226,16 +205,7 @@ define void @loop_contains_store_fcmp_condition(ptr dereferenceable(40) noalias ; CHECK-NEXT: [[TMP27:%.*]] = add i64 [[TMP26]], [[TMP5]] ; CHECK-NEXT: [[TMP28:%.*]] = icmp ne i64 [[TMP5]], [[TMP21]] ; CHECK-NEXT: [[TMP29:%.*]] = select i1 [[TMP28]], i64 [[TMP27]], i64 [[TMP24]] -; CHECK-NEXT: [[TMP40:%.*]] = call i64 @llvm.vscale.i64() -; CHECK-NEXT: [[TMP41:%.*]] = mul nuw i64 [[TMP40]], 4 -; CHECK-NEXT: [[TMP42:%.*]] = mul i64 [[TMP41]], 0 -; CHECK-NEXT: [[TMP34:%.*]] = extractelement <vscale x 4 x i64> [[VEC_IND]], i64 0 -; CHECK-NEXT: [[TMP35:%.*]] = mul i64 [[TMP41]], 1 -; CHECK-NEXT: [[TMP36:%.*]] = sub i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP37:%.*]] = extractelement <vscale x 4 x i64> [[STEP_ADD]], i64 [[TMP36]] -; CHECK-NEXT: [[TMP38:%.*]] = icmp uge i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP39:%.*]] = select i1 [[TMP38]], i64 [[TMP37]], i64 [[TMP34]] -; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[TMP39]], [[TMP29]] +; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[INDEX]], [[TMP29]] ; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[TMP11]], 20 ; CHECK-NEXT: br i1 [[TMP12]], label %[[EXIT:.*]], label %[[SCALAR_PH]] ; CHECK: [[SCALAR_PH]]: @@ -448,16 +418,11 @@ define void @loop_contains_store_to_pointer_with_no_deref_info(ptr align 2 deref ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH1:.*]], label %[[VECTOR_PH:.*]] ; CHECK: [[VECTOR_PH]]: ; CHECK-NEXT: [[TMP2:%.*]] = shl nuw i64 [[TMP0]], 2 -; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i64> poison, i64 [[TMP2]], i64 0 -; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 20, [[TMP1]] ; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 20, [[N_MOD_VF]] -; CHECK-NEXT: [[TMP16:%.*]] = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64() ; CHECK-NEXT: br label %[[FOR_BODY:.*]] ; CHECK: [[FOR_BODY]]: ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[FOR_BODY]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <vscale x 4 x i64> [ [[TMP16]], %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[FOR_BODY]] ] -; CHECK-NEXT: [[STEP_ADD:%.*]] = add nuw <vscale x 4 x i64> [[VEC_IND]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw i16, ptr [[PRED]], i64 [[IV]] ; CHECK-NEXT: [[TMP19:%.*]] = getelementptr inbounds nuw i16, ptr [[TMP5]], i64 [[TMP2]] ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <vscale x 4 x i16>, ptr [[TMP5]], align 2 @@ -487,7 +452,6 @@ define void @loop_contains_store_to_pointer_with_no_deref_info(ptr align 2 deref ; CHECK-NEXT: [[TMP11:%.*]] = call i1 @llvm.vector.reduce.or.nxv4i1(<vscale x 4 x i1> [[TMP18]]) ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[IV]], [[TMP1]] ; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <vscale x 4 x i64> [[STEP_ADD]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP13:%.*]] = or i1 [[TMP11]], [[TMP12]] ; CHECK-NEXT: br i1 [[TMP13]], label %[[MIDDLE_BLOCK:.*]], label %[[FOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]] ; CHECK: [[MIDDLE_BLOCK]]: @@ -501,16 +465,7 @@ define void @loop_contains_store_to_pointer_with_no_deref_info(ptr align 2 deref ; CHECK-NEXT: [[TMP29:%.*]] = add i64 [[TMP28]], [[TMP7]] ; CHECK-NEXT: [[TMP30:%.*]] = icmp ne i64 [[TMP7]], [[TMP23]] ; CHECK-NEXT: [[TMP31:%.*]] = select i1 [[TMP30]], i64 [[TMP29]], i64 [[TMP26]] -; CHECK-NEXT: [[TMP42:%.*]] = call i64 @llvm.vscale.i64() -; CHECK-NEXT: [[TMP43:%.*]] = mul nuw i64 [[TMP42]], 4 -; CHECK-NEXT: [[TMP35:%.*]] = mul i64 [[TMP43]], 0 -; CHECK-NEXT: [[TMP36:%.*]] = extractelement <vscale x 4 x i64> [[VEC_IND]], i64 0 -; CHECK-NEXT: [[TMP37:%.*]] = mul i64 [[TMP43]], 1 -; CHECK-NEXT: [[TMP38:%.*]] = sub i64 0, [[TMP37]] -; CHECK-NEXT: [[TMP39:%.*]] = extractelement <vscale x 4 x i64> [[STEP_ADD]], i64 [[TMP38]] -; CHECK-NEXT: [[TMP40:%.*]] = icmp uge i64 0, [[TMP37]] -; CHECK-NEXT: [[TMP41:%.*]] = select i1 [[TMP40]], i64 [[TMP39]], i64 [[TMP36]] -; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[TMP41]], [[TMP31]] +; CHECK-NEXT: [[TMP14:%.*]] = add i64 [[IV]], [[TMP31]] ; CHECK-NEXT: [[TMP15:%.*]] = icmp eq i64 [[TMP14]], 20 ; CHECK-NEXT: br i1 [[TMP15]], label %[[EXIT:.*]], label %[[SCALAR_PH1]] ; CHECK: [[SCALAR_PH1]]: @@ -613,16 +568,11 @@ define void @loop_contains_store_in_latch_block(ptr dereferenceable(40) noalias ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]] ; CHECK: [[VECTOR_PH]]: ; CHECK-NEXT: [[TMP2:%.*]] = shl nuw i64 [[TMP0]], 2 -; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i64> poison, i64 [[TMP2]], i64 0 -; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 20, [[TMP1]] ; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 20, [[N_MOD_VF]] -; CHECK-NEXT: [[TMP17:%.*]] = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64() ; CHECK-NEXT: br label %[[FOR_BODY1:.*]] ; CHECK: [[FOR_BODY1]]: ; CHECK-NEXT: [[IV1:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[FOR_BODY1]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <vscale x 4 x i64> [ [[TMP17]], %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[FOR_BODY1]] ] -; CHECK-NEXT: [[STEP_ADD:%.*]] = add nuw <vscale x 4 x i64> [[VEC_IND]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[EE_ADDR1:%.*]] = getelementptr inbounds nuw i16, ptr [[PRED]], i64 [[IV1]] ; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds nuw i16, ptr [[EE_ADDR1]], i64 [[TMP2]] ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <vscale x 4 x i16>, ptr [[EE_ADDR1]], align 2 @@ -650,7 +600,6 @@ define void @loop_contains_store_in_latch_block(ptr dereferenceable(40) noalias ; CHECK-NEXT: [[TMP10:%.*]] = call i1 @llvm.vector.reduce.or.nxv4i1(<vscale x 4 x i1> [[TMP16]]) ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[IV1]], [[TMP1]] ; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <vscale x 4 x i64> [[STEP_ADD]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP12:%.*]] = or i1 [[TMP10]], [[TMP11]] ; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[FOR_BODY1]], !llvm.loop [[LOOP8:![0-9]+]] ; CHECK: [[MIDDLE_BLOCK]]: @@ -664,16 +613,7 @@ define void @loop_contains_store_in_latch_block(ptr dereferenceable(40) noalias ; CHECK-NEXT: [[TMP27:%.*]] = add i64 [[TMP26]], [[TMP6]] ; CHECK-NEXT: [[TMP28:%.*]] = icmp ne i64 [[TMP6]], [[TMP21]] ; CHECK-NEXT: [[TMP29:%.*]] = select i1 [[TMP28]], i64 [[TMP27]], i64 [[TMP24]] -; CHECK-NEXT: [[TMP40:%.*]] = call i64 @llvm.vscale.i64() -; CHECK-NEXT: [[TMP41:%.*]] = mul nuw i64 [[TMP40]], 4 -; CHECK-NEXT: [[TMP33:%.*]] = mul i64 [[TMP41]], 0 -; CHECK-NEXT: [[TMP34:%.*]] = extractelement <vscale x 4 x i64> [[VEC_IND]], i64 0 -; CHECK-NEXT: [[TMP35:%.*]] = mul i64 [[TMP41]], 1 -; CHECK-NEXT: [[TMP36:%.*]] = sub i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP37:%.*]] = extractelement <vscale x 4 x i64> [[STEP_ADD]], i64 [[TMP36]] -; CHECK-NEXT: [[TMP38:%.*]] = icmp uge i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP39:%.*]] = select i1 [[TMP38]], i64 [[TMP37]], i64 [[TMP34]] -; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[TMP39]], [[TMP29]] +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[IV1]], [[TMP29]] ; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i64 [[TMP13]], 20 ; CHECK-NEXT: br i1 [[TMP14]], label %[[EXIT:.*]], label %[[SCALAR_PH]] ; CHECK: [[SCALAR_PH]]: @@ -1325,16 +1265,11 @@ define i32 @uncountable_exit_with_separate_exit_block(ptr dereferenceable(40) no ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label %[[SCALAR_PH1:.*]], label %[[VECTOR_PH:.*]] ; CHECK: [[VECTOR_PH]]: ; CHECK-NEXT: [[TMP2:%.*]] = shl nuw i64 [[TMP0]], 2 -; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i64> poison, i64 [[TMP2]], i64 0 -; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 20, [[TMP1]] ; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 20, [[N_MOD_VF]] -; CHECK-NEXT: [[TMP17:%.*]] = call <vscale x 4 x i64> @llvm.stepvector.nxv4i64() ; CHECK-NEXT: br label %[[FOR_BODY1:.*]] ; CHECK: [[FOR_BODY1]]: ; CHECK-NEXT: [[IV1:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[FOR_BODY1]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <vscale x 4 x i64> [ [[TMP17]], %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[FOR_BODY1]] ] -; CHECK-NEXT: [[STEP_ADD:%.*]] = add nuw <vscale x 4 x i64> [[VEC_IND]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr inbounds nuw i16, ptr [[PRED]], i64 [[IV1]] ; CHECK-NEXT: [[TMP18:%.*]] = getelementptr inbounds nuw i16, ptr [[TMP5]], i64 [[TMP2]] ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <vscale x 4 x i16>, ptr [[TMP5]], align 2 @@ -1362,7 +1297,6 @@ define i32 @uncountable_exit_with_separate_exit_block(ptr dereferenceable(40) no ; CHECK-NEXT: [[TMP10:%.*]] = call i1 @llvm.vector.reduce.or.nxv4i1(<vscale x 4 x i1> [[TMP16]]) ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[IV1]], [[TMP1]] ; CHECK-NEXT: [[TMP11:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <vscale x 4 x i64> [[STEP_ADD]], [[BROADCAST_SPLAT]] ; CHECK-NEXT: [[TMP12:%.*]] = or i1 [[TMP10]], [[TMP11]] ; CHECK-NEXT: br i1 [[TMP12]], label %[[MIDDLE_BLOCK:.*]], label %[[FOR_BODY1]], !llvm.loop [[LOOP10:![0-9]+]] ; CHECK: [[MIDDLE_BLOCK]]: @@ -1376,16 +1310,7 @@ define i32 @uncountable_exit_with_separate_exit_block(ptr dereferenceable(40) no ; CHECK-NEXT: [[TMP27:%.*]] = add i64 [[TMP26]], [[TMP7]] ; CHECK-NEXT: [[TMP28:%.*]] = icmp ne i64 [[TMP7]], [[TMP21]] ; CHECK-NEXT: [[TMP29:%.*]] = select i1 [[TMP28]], i64 [[TMP27]], i64 [[TMP24]] -; CHECK-NEXT: [[TMP40:%.*]] = call i64 @llvm.vscale.i64() -; CHECK-NEXT: [[TMP41:%.*]] = mul nuw i64 [[TMP40]], 4 -; CHECK-NEXT: [[TMP33:%.*]] = mul i64 [[TMP41]], 0 -; CHECK-NEXT: [[TMP34:%.*]] = extractelement <vscale x 4 x i64> [[VEC_IND]], i64 0 -; CHECK-NEXT: [[TMP35:%.*]] = mul i64 [[TMP41]], 1 -; CHECK-NEXT: [[TMP36:%.*]] = sub i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP37:%.*]] = extractelement <vscale x 4 x i64> [[STEP_ADD]], i64 [[TMP36]] -; CHECK-NEXT: [[TMP38:%.*]] = icmp uge i64 0, [[TMP35]] -; CHECK-NEXT: [[TMP39:%.*]] = select i1 [[TMP38]], i64 [[TMP37]], i64 [[TMP34]] -; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[TMP39]], [[TMP29]] +; CHECK-NEXT: [[TMP13:%.*]] = add i64 [[IV1]], [[TMP29]] ; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i64 [[TMP13]], 20 ; CHECK-NEXT: br i1 [[TMP14]], label %[[EXIT_COUNTABLE:.*]], label %[[SCALAR_PH1]] ; CHECK: [[SCALAR_PH1]]: diff --git a/llvm/test/Transforms/LoopVectorize/VPlan/early_exit_with_stores_vplan.ll b/llvm/test/Transforms/LoopVectorize/VPlan/early_exit_with_stores_vplan.ll index 7b403e6835b11..b5eed1f8f1600 100644 --- a/llvm/test/Transforms/LoopVectorize/VPlan/early_exit_with_stores_vplan.ll +++ b/llvm/test/Transforms/LoopVectorize/VPlan/early_exit_with_stores_vplan.ll @@ -21,7 +21,6 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-NEXT: vp<[[VP3:%[0-9]+]]> = CANONICAL-IV ; CHECK-EMPTY: ; CHECK-NEXT: vector.body: -; CHECK-NEXT: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: vp<[[VP4:%[0-9]+]]> = SCALAR-STEPS vp<[[VP3]]>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: CLONE ir<%ee.addr> = getelementptr inbounds nuw ir<%pred>, vp<[[VP4]]> ; CHECK-NEXT: vp<[[VP5:%[0-9]+]]> = vector-pointer inbounds nuw i16, ir<%ee.addr>, ir<1> @@ -44,17 +43,16 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-EMPTY: ; CHECK-NEXT: middle.block: ; CHECK-NEXT: EMIT vp<[[VP11:%[0-9]+]]> = first-active-lane vp<[[VP6]]> -; CHECK-NEXT: EMIT vp<[[VP12:%[0-9]+]]> = extract-lane ir<0>, ir<%iv> -; CHECK-NEXT: EMIT vp<[[VP13:%[0-9]+]]> = add vp<[[VP12]]>, vp<[[VP11]]> -; CHECK-NEXT: EMIT vp<[[VP14:%[0-9]+]]> = icmp eq vp<[[VP13]]>, ir<20> -; CHECK-NEXT: EMIT branch-on-cond vp<[[VP14]]> +; CHECK-NEXT: EMIT vp<[[VP12:%[0-9]+]]> = add vp<[[VP3]]>, vp<[[VP11]]> +; CHECK-NEXT: EMIT vp<[[VP13:%[0-9]+]]> = icmp eq vp<[[VP12]]>, ir<20> +; CHECK-NEXT: EMIT branch-on-cond vp<[[VP13]]> ; CHECK-NEXT: Successor(s): ir-bb<exit>, scalar.ph ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<exit>: ; CHECK-NEXT: No successors ; CHECK-EMPTY: ; CHECK-NEXT: scalar.ph: -; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP13]]>, middle.block ], [ ir<0>, ir-bb<entry> ] +; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP12]]>, middle.block ], [ ir<0>, ir-bb<entry> ] ; CHECK-NEXT: Successor(s): ir-bb<for.body> ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<for.body>: @@ -110,7 +108,6 @@ define void @loop_contains_store_after_uncountable_exit(ptr dereferenceable(40) ; CHECK-NEXT: vp<[[VP3:%[0-9]+]]> = CANONICAL-IV ; CHECK-EMPTY: ; CHECK-NEXT: vector.body: -; CHECK-NEXT: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: vp<[[VP4:%[0-9]+]]> = SCALAR-STEPS vp<[[VP3]]>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: CLONE ir<%ee.addr> = getelementptr inbounds nuw ir<%pred>, vp<[[VP4]]> ; CHECK-NEXT: vp<[[VP5:%[0-9]+]]> = vector-pointer inbounds nuw i16, ir<%ee.addr>, ir<1> @@ -133,17 +130,16 @@ define void @loop_contains_store_after_uncountable_exit(ptr dereferenceable(40) ; CHECK-EMPTY: ; CHECK-NEXT: middle.block: ; CHECK-NEXT: EMIT vp<[[VP11:%[0-9]+]]> = first-active-lane vp<[[VP6]]> -; CHECK-NEXT: EMIT vp<[[VP12:%[0-9]+]]> = extract-lane ir<0>, ir<%iv> -; CHECK-NEXT: EMIT vp<[[VP13:%[0-9]+]]> = add vp<[[VP12]]>, vp<[[VP11]]> -; CHECK-NEXT: EMIT vp<[[VP14:%[0-9]+]]> = icmp eq vp<[[VP13]]>, ir<20> -; CHECK-NEXT: EMIT branch-on-cond vp<[[VP14]]> +; CHECK-NEXT: EMIT vp<[[VP12:%[0-9]+]]> = add vp<[[VP3]]>, vp<[[VP11]]> +; CHECK-NEXT: EMIT vp<[[VP13:%[0-9]+]]> = icmp eq vp<[[VP12]]>, ir<20> +; CHECK-NEXT: EMIT branch-on-cond vp<[[VP13]]> ; CHECK-NEXT: Successor(s): ir-bb<exit>, scalar.ph ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<exit>: ; CHECK-NEXT: No successors ; CHECK-EMPTY: ; CHECK-NEXT: scalar.ph: -; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP13]]>, middle.block ], [ ir<0>, ir-bb<entry> ] +; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP12]]>, middle.block ], [ ir<0>, ir-bb<entry> ] ; CHECK-NEXT: Successor(s): ir-bb<for.body> ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<for.body>: @@ -195,7 +191,6 @@ define i16 @uncountable_exit_with_live_out(ptr dereferenceable(40) noalias %arra ; CHECK-NEXT: vp<[[VP3:%[0-9]+]]> = CANONICAL-IV ; CHECK-EMPTY: ; CHECK-NEXT: vector.body: -; CHECK-NEXT: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: vp<[[VP4:%[0-9]+]]> = SCALAR-STEPS vp<[[VP3]]>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: CLONE ir<%ee.addr> = getelementptr inbounds nuw ir<%pred>, vp<[[VP4]]> ; CHECK-NEXT: vp<[[VP5:%[0-9]+]]> = vector-pointer inbounds nuw i16, ir<%ee.addr>, ir<1> @@ -220,10 +215,9 @@ define i16 @uncountable_exit_with_live_out(ptr dereferenceable(40) noalias %arra ; CHECK-NEXT: EMIT vp<[[VP11:%[0-9]+]]> = extract-last-part ir<%data> ; CHECK-NEXT: EMIT vp<[[VP12:%[0-9]+]]> = extract-last-lane vp<[[VP11]]> ; CHECK-NEXT: EMIT vp<[[VP13:%[0-9]+]]> = first-active-lane vp<[[VP6]]> -; CHECK-NEXT: EMIT vp<[[VP14:%[0-9]+]]> = extract-lane ir<0>, ir<%iv> -; CHECK-NEXT: EMIT vp<[[VP15:%[0-9]+]]> = add vp<[[VP14]]>, vp<[[VP13]]> -; CHECK-NEXT: EMIT vp<[[VP16:%[0-9]+]]> = icmp eq vp<[[VP15]]>, ir<20> -; CHECK-NEXT: EMIT branch-on-cond vp<[[VP16]]> +; CHECK-NEXT: EMIT vp<[[VP14:%[0-9]+]]> = add vp<[[VP3]]>, vp<[[VP13]]> +; CHECK-NEXT: EMIT vp<[[VP15:%[0-9]+]]> = icmp eq vp<[[VP14]]>, ir<20> +; CHECK-NEXT: EMIT branch-on-cond vp<[[VP15]]> ; CHECK-NEXT: Successor(s): ir-bb<exit>, scalar.ph ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<exit>: @@ -231,7 +225,7 @@ define i16 @uncountable_exit_with_live_out(ptr dereferenceable(40) noalias %arra ; CHECK-NEXT: No successors ; CHECK-EMPTY: ; CHECK-NEXT: scalar.ph: -; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP15]]>, middle.block ], [ ir<0>, ir-bb<entry> ] +; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP14]]>, middle.block ], [ ir<0>, ir-bb<entry> ] ; CHECK-NEXT: Successor(s): ir-bb<for.body> ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<for.body>: @@ -287,7 +281,6 @@ define void @combined_exit_conditions(ptr align 4 dereferenceable(80) readonly % ; CHECK-NEXT: vp<[[VP3:%[0-9]+]]> = CANONICAL-IV ; CHECK-EMPTY: ; CHECK-NEXT: vector.body: -; CHECK-NEXT: ir<%iv> = WIDEN-INDUCTION nuw nsw ir<0>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: vp<[[VP4:%[0-9]+]]> = SCALAR-STEPS vp<[[VP3]]>, ir<1>, vp<[[VP0]]> ; CHECK-NEXT: CLONE ir<%ee.ptr> = getelementptr inbounds nuw ir<%pred>, vp<[[VP4]]> ; CHECK-NEXT: vp<[[VP5:%[0-9]+]]> = vector-pointer inbounds nuw i32, ir<%ee.ptr>, ir<1> @@ -313,17 +306,16 @@ define void @combined_exit_conditions(ptr align 4 dereferenceable(80) readonly % ; CHECK-EMPTY: ; CHECK-NEXT: middle.block: ; CHECK-NEXT: EMIT vp<[[VP13:%[0-9]+]]> = first-active-lane vp<[[VP7]]> -; CHECK-NEXT: EMIT vp<[[VP14:%[0-9]+]]> = extract-lane ir<0>, ir<%iv> -; CHECK-NEXT: EMIT vp<[[VP15:%[0-9]+]]> = add vp<[[VP14]]>, vp<[[VP13]]> -; CHECK-NEXT: EMIT vp<[[VP16:%[0-9]+]]> = icmp eq vp<[[VP15]]>, ir<20> -; CHECK-NEXT: EMIT branch-on-cond vp<[[VP16]]> +; CHECK-NEXT: EMIT vp<[[VP14:%[0-9]+]]> = add vp<[[VP3]]>, vp<[[VP13]]> +; CHECK-NEXT: EMIT vp<[[VP15:%[0-9]+]]> = icmp eq vp<[[VP14]]>, ir<20> +; CHECK-NEXT: EMIT branch-on-cond vp<[[VP15]]> ; CHECK-NEXT: Successor(s): ir-bb<exit>, scalar.ph ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<exit>: ; CHECK-NEXT: No successors ; CHECK-EMPTY: ; CHECK-NEXT: scalar.ph: -; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP15]]>, middle.block ], [ ir<0>, ir-bb<entry> ] +; CHECK-NEXT: EMIT-SCALAR vp<%bc.resume.val> = phi [ vp<[[VP14]]>, middle.block ], [ ir<0>, ir-bb<entry> ] ; CHECK-NEXT: Successor(s): ir-bb<for.body> ; CHECK-EMPTY: ; CHECK-NEXT: ir-bb<for.body>: diff --git a/llvm/test/Transforms/LoopVectorize/interleave_uncountable_exits.ll b/llvm/test/Transforms/LoopVectorize/interleave_uncountable_exits.ll index 0fbca21c9d31d..844ce930dcaee 100644 --- a/llvm/test/Transforms/LoopVectorize/interleave_uncountable_exits.ll +++ b/llvm/test/Transforms/LoopVectorize/interleave_uncountable_exits.ll @@ -10,8 +10,6 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-NEXT: br label %[[VECTOR_BODY:.*]] ; CHECK: [[VECTOR_BODY]]: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[VECTOR_BODY]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[VECTOR_BODY]] ] -; CHECK-NEXT: [[STEP_ADD:%.*]] = add nuw <4 x i64> [[VEC_IND]], splat (i64 4) ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw i16, ptr [[PRED]], i64 [[INDEX]] ; CHECK-NEXT: [[TMP13:%.*]] = getelementptr inbounds nuw i16, ptr [[TMP1]], i64 4 ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i16>, ptr [[TMP1]], align 2 @@ -39,7 +37,6 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-NEXT: [[TMP6:%.*]] = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> [[TMP12]]) ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 8 ; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i64 [[INDEX_NEXT]], 16 -; CHECK-NEXT: [[VEC_IND_NEXT]] = add nuw nsw <4 x i64> [[STEP_ADD]], splat (i64 4) ; CHECK-NEXT: [[TMP8:%.*]] = or i1 [[TMP6]], [[TMP7]] ; CHECK-NEXT: br i1 [[TMP8]], label %[[MIDDLE_BLOCK:.*]], label %[[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] ; CHECK: [[MIDDLE_BLOCK]]: @@ -49,10 +46,7 @@ define void @loop_contains_store_condition_load_has_single_user(ptr dereferencea ; CHECK-NEXT: [[TMP19:%.*]] = add i64 0, [[TMP18]] ; CHECK-NEXT: [[TMP20:%.*]] = icmp ne i64 [[TMP18]], 4 ; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP20]], i64 [[TMP19]], i64 [[TMP17]] -; CHECK-NEXT: [[TMP26:%.*]] = extractelement <4 x i64> [[VEC_IND]], i64 0 -; CHECK-NEXT: [[TMP27:%.*]] = extractelement <4 x i64> [[STEP_ADD]], i64 -4 -; CHECK-NEXT: [[TMP25:%.*]] = select i1 false, i64 [[TMP27]], i64 [[TMP26]] -; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[TMP25]], [[TMP3]] +; CHECK-NEXT: [[TMP9:%.*]] = add i64 [[INDEX]], [[TMP3]] ; CHECK-NEXT: [[TMP10:%.*]] = icmp eq i64 [[TMP9]], 20 ; CHECK-NEXT: br i1 [[TMP10]], label %[[EXIT:.*]], label %[[SCALAR_PH:.*]] ; CHECK: [[SCALAR_PH]]: diff --git a/llvm/test/Transforms/PhaseOrdering/AArch64/countable-and-uncountable-exits-combined.ll b/llvm/test/Transforms/PhaseOrdering/AArch64/countable-and-uncountable-exits-combined.ll index af05a83af9231..aa7939535c934 100644 --- a/llvm/test/Transforms/PhaseOrdering/AArch64/countable-and-uncountable-exits-combined.ll +++ b/llvm/test/Transforms/PhaseOrdering/AArch64/countable-and-uncountable-exits-combined.ll @@ -34,14 +34,9 @@ define void @foo() #0 { ; CHECK-NEXT: [[TMP13:%.*]] = shl nuw nsw i64 [[TMP0]], 2 ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 10000, [[TMP1]] ; CHECK-NEXT: [[N_VEC:%.*]] = sub nuw nsw i64 10000, [[N_MOD_VF]] -; CHECK-NEXT: [[TMP30:%.*]] = tail call <vscale x 4 x i64> @llvm.stepvector.nxv4i64() -; CHECK-NEXT: [[DOTSCALAR:%.*]] = shl nuw nsw i64 [[TMP0]], 3 -; CHECK-NEXT: [[TMP31:%.*]] = insertelement <vscale x 4 x i64> poison, i64 [[DOTSCALAR]], i64 0 -; CHECK-NEXT: [[REASS_ADD:%.*]] = shufflevector <vscale x 4 x i64> [[TMP31]], <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer ; CHECK-NEXT: br label %[[FOR_BODY:.*]] ; CHECK: [[FOR_BODY]]: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %[[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], %[[FOR_BODY]] ] -; CHECK-NEXT: [[VEC_IND:%.*]] = phi <vscale x 4 x i64> [ [[TMP30]], %[[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], %[[FOR_BODY]] ] ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [4 x i8], ptr @c, i64 [[INDEX]] ; CHECK-NEXT: [[TMP17:%.*]] = getelementptr inbounds nuw [4 x i8], ptr [[TMP2]], i64 [[TMP13]] ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <vscale x 4 x i32>, ptr [[TMP2]], align 4 @@ -72,7 +67,6 @@ define void @foo() #0 { ; CHECK-NEXT: [[TMP8:%.*]] = tail call i1 @llvm.vector.reduce.or.nxv4i1(<vscale x 4 x i1> [[TMP16]]) ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], [[TMP1]] ; CHECK-NEXT: [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] -; CHECK-NEXT: [[VEC_IND_NEXT]] = add <vscale x 4 x i64> [[VEC_IND]], [[REASS_ADD]] ; CHECK-NEXT: [[TMP10:%.*]] = or i1 [[TMP8]], [[TMP9]] ; CHECK-NEXT: br i1 [[TMP10]], label %[[MIDDLE_BLOCK:.*]], label %[[FOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]] ; CHECK: [[MIDDLE_BLOCK]]: @@ -83,8 +77,7 @@ define void @foo() #0 { ; CHECK-NEXT: [[TMP4:%.*]] = tail call i64 @llvm.experimental.cttz.elts.i64.nxv4i1(<vscale x 4 x i1> [[TMP3]], i1 false) ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i64 [[TMP4]], [[TMP21]] ; CHECK-NEXT: [[TMP25:%.*]] = select i1 [[DOTNOT]], i64 [[TMP23]], i64 [[TMP4]] -; CHECK-NEXT: [[TMP29:%.*]] = extractelement <vscale x 4 x i64> [[VEC_IND]], i64 0 -; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[TMP29]], [[TMP25]] +; CHECK-NEXT: [[TMP11:%.*]] = add i64 [[INDEX]], [[TMP25]] ; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i64 [[TMP11]], 10000 ; CHECK-NEXT: br i1 [[TMP12]], label %[[EXIT:.*]], label %[[FOR_BODY_PREHEADER]] ; CHECK: [[FOR_BODY_PREHEADER]]: _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
