Skip to content

Commit f4e7f8a

Browse files
committed
!fixup don't multiply by type size.
1 parent e80224d commit f4e7f8a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -831,9 +831,6 @@ Value *VPInstruction::generate(VPTransformState &State) {
831831
// preceding operands.
832832
Value *RuntimeVF =
833833
getRuntimeVF(State.Builder, State.Builder.getInt64Ty(), State.VF);
834-
Type *ElemTy = State.TypeAnalysis.inferScalarType(getOperand(0));
835-
Value *RuntimeBitwidth = Builder.CreateMul(
836-
Builder.getInt64(ElemTy->getScalarSizeInBits()), RuntimeVF);
837834
unsigned LastOpIdx = getNumOperands() - 1;
838835
Value *Res = nullptr;
839836
for (int Idx = LastOpIdx; Idx >= 0; --Idx) {
@@ -842,7 +839,7 @@ Value *VPInstruction::generate(VPTransformState &State) {
842839
Value *Current = Builder.CreateAdd(
843840
Builder.CreateMul(RuntimeVF, Builder.getInt64(Idx)), TrailingZeros);
844841
if (Res) {
845-
Value *Cmp = Builder.CreateICmpNE(TrailingZeros, RuntimeBitwidth);
842+
Value *Cmp = Builder.CreateICmpNE(TrailingZeros, RuntimeVF);
846843
Res = Builder.CreateSelect(Cmp, Current, Res);
847844
} else {
848845
Res = Current;

llvm/test/Transforms/LoopVectorize/AArch64/single-early-exit-interleave.ll

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,23 @@ define i64 @same_exit_block_pre_inc_use1() #0 {
7676
; CHECK: vector.early.exit:
7777
; CHECK-NEXT: [[TMP63:%.*]] = call i64 @llvm.vscale.i64()
7878
; CHECK-NEXT: [[TMP42:%.*]] = mul nuw i64 [[TMP63]], 16
79-
; CHECK-NEXT: [[TMP43:%.*]] = mul i64 1, [[TMP42]]
8079
; CHECK-NEXT: [[TMP44:%.*]] = call i64 @llvm.experimental.cttz.elts.i64.nxv16i1(<vscale x 16 x i1> [[TMP32]], i1 true)
8180
; CHECK-NEXT: [[TMP62:%.*]] = mul i64 [[TMP42]], 3
8281
; CHECK-NEXT: [[TMP45:%.*]] = add i64 [[TMP62]], [[TMP44]]
8382
; CHECK-NEXT: [[TMP46:%.*]] = call i64 @llvm.experimental.cttz.elts.i64.nxv16i1(<vscale x 16 x i1> [[TMP31]], i1 true)
8483
; CHECK-NEXT: [[TMP58:%.*]] = mul i64 [[TMP42]], 2
8584
; CHECK-NEXT: [[TMP50:%.*]] = add i64 [[TMP58]], [[TMP46]]
86-
; CHECK-NEXT: [[TMP47:%.*]] = icmp ne i64 [[TMP46]], [[TMP43]]
85+
; CHECK-NEXT: [[TMP47:%.*]] = icmp ne i64 [[TMP46]], [[TMP42]]
8786
; CHECK-NEXT: [[TMP51:%.*]] = select i1 [[TMP47]], i64 [[TMP50]], i64 [[TMP45]]
8887
; CHECK-NEXT: [[TMP52:%.*]] = call i64 @llvm.experimental.cttz.elts.i64.nxv16i1(<vscale x 16 x i1> [[TMP30]], i1 true)
8988
; CHECK-NEXT: [[TMP64:%.*]] = mul i64 [[TMP42]], 1
9089
; CHECK-NEXT: [[TMP56:%.*]] = add i64 [[TMP64]], [[TMP52]]
91-
; CHECK-NEXT: [[TMP53:%.*]] = icmp ne i64 [[TMP52]], [[TMP43]]
90+
; CHECK-NEXT: [[TMP53:%.*]] = icmp ne i64 [[TMP52]], [[TMP42]]
9291
; CHECK-NEXT: [[TMP57:%.*]] = select i1 [[TMP53]], i64 [[TMP56]], i64 [[TMP51]]
9392
; CHECK-NEXT: [[TMP15:%.*]] = call i64 @llvm.experimental.cttz.elts.i64.nxv16i1(<vscale x 16 x i1> [[TMP11]], i1 true)
9493
; CHECK-NEXT: [[TMP65:%.*]] = mul i64 [[TMP42]], 0
9594
; CHECK-NEXT: [[TMP60:%.*]] = add i64 [[TMP65]], [[TMP15]]
96-
; CHECK-NEXT: [[TMP59:%.*]] = icmp ne i64 [[TMP15]], [[TMP43]]
95+
; CHECK-NEXT: [[TMP59:%.*]] = icmp ne i64 [[TMP15]], [[TMP42]]
9796
; CHECK-NEXT: [[TMP61:%.*]] = select i1 [[TMP59]], i64 [[TMP60]], i64 [[TMP57]]
9897
; CHECK-NEXT: [[TMP16:%.*]] = add i64 [[INDEX1]], [[TMP61]]
9998
; CHECK-NEXT: [[TMP17:%.*]] = add i64 3, [[TMP16]]

0 commit comments

Comments
 (0)