[PATCH] D133497: [VPlan] Only generate single instr for stores uniform across all parts.
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 9 07:25:23 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGedb26268ce6e: [VPlan] Only generate single instr for stores uniform across all parts. (authored by reames).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133497/new/
https://reviews.llvm.org/D133497
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll
llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
Index: llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
+++ llvm/test/Transforms/LoopVectorize/X86/uniform_mem_op.ll
@@ -179,9 +179,6 @@
; CHECK: vector.body:
; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
; CHECK-NEXT: store i32 0, i32* [[ADDR:%.*]], align 4
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
-; CHECK-NEXT: store i32 0, i32* [[ADDR]], align 4
; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 16
; CHECK-NEXT: [[TMP0:%.*]] = icmp eq i64 [[INDEX_NEXT]], 4096
; CHECK-NEXT: br i1 [[TMP0]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP8:![0-9]+]]
Index: llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll
+++ llvm/test/Transforms/LoopVectorize/RISCV/uniform-load-store.ll
@@ -805,7 +805,6 @@
; FIXEDLEN-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0
; FIXEDLEN-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 2
; FIXEDLEN-NEXT: store i64 [[V]], ptr [[B:%.*]], align 8
-; FIXEDLEN-NEXT: store i64 [[V]], ptr [[B]], align 8
; FIXEDLEN-NEXT: [[TMP2:%.*]] = getelementptr inbounds i64, ptr [[A:%.*]], i64 [[TMP0]]
; FIXEDLEN-NEXT: [[TMP3:%.*]] = getelementptr inbounds i64, ptr [[A]], i64 [[TMP1]]
; FIXEDLEN-NEXT: [[TMP4:%.*]] = getelementptr inbounds i64, ptr [[TMP2]], i32 0
@@ -1430,7 +1429,6 @@
; FIXEDLEN-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0
; FIXEDLEN-NEXT: [[TMP1:%.*]] = add i64 [[INDEX]], 2
; FIXEDLEN-NEXT: store i64 [[V]], ptr [[B:%.*]], align 1
-; FIXEDLEN-NEXT: store i64 [[V]], ptr [[B]], align 1
; FIXEDLEN-NEXT: [[TMP2:%.*]] = getelementptr inbounds i64, ptr [[A:%.*]], i64 [[TMP0]]
; FIXEDLEN-NEXT: [[TMP3:%.*]] = getelementptr inbounds i64, ptr [[A]], i64 [[TMP1]]
; FIXEDLEN-NEXT: [[TMP4:%.*]] = getelementptr inbounds i64, ptr [[TMP2]], i32 0
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9642,13 +9642,15 @@
// If the recipe is uniform across all parts (instead of just per VF), only
// generate a single instance.
Instruction *UI = getUnderlyingInstr();
- if (isa<LoadInst>(UI) &&
+ if ((isa<LoadInst>(UI) || isa<StoreInst>(UI)) &&
all_of(operands(), [](VPValue *Op) { return !Op->getDef(); })) {
State.ILV->scalarizeInstruction(UI, this, VPIteration(0, 0), IsPredicated,
State);
- for (unsigned Part = 1; Part < State.UF; ++Part)
- State.set(this, State.get(this, VPIteration(0, 0)),
- VPIteration(Part, 0));
+ if (!UI->getType()->isVoidTy()) {
+ for (unsigned Part = 1; Part < State.UF; ++Part)
+ State.set(this, State.get(this, VPIteration(0, 0)),
+ VPIteration(Part, 0));
+ }
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133497.459058.patch
Type: text/x-patch
Size: 3272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220909/987089c5/attachment.bin>
More information about the llvm-commits
mailing list