[PATCH] D157443: [VPlan] Update printOperands with dedicated mask printing.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 8 14:41:32 PDT 2023
fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin.
Herald added subscribers: StephenFan, tschuett, psnobl, rogfer01, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: wangpc, vkmr.
Herald added a project: LLVM.
Building on generic mask handling, update printOperands with dedicated
printing for mask operands (clearly identifying them as a mask).
Depends on D157442 <https://reviews.llvm.org/D157442>.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D157443
Files:
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
llvm/lib/Transforms/Vectorize/VPlanValue.h
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
Index: llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
===================================================================
--- llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
+++ llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-forced.ll
@@ -28,7 +28,7 @@
; VPLANS-NEXT: ACTIVE-LANE-MASK-PHI vp<[[LANEMASK_PHI:%[0-9]+]]> = phi vp<[[LANEMASK_ENTRY]]>, vp<[[LANEMASK_LOOP:%[0-9]+]]>
; VPLANS-NEXT: vp<[[STEP:%[0-9]+]]> = SCALAR-STEPS vp<[[INDV]]>, ir<1>
; VPLANS-NEXT: CLONE ir<%gep> = getelementptr ir<%ptr>, vp<[[STEP]]>
-; VPLANS-NEXT: WIDEN store ir<%gep>, ir<%val>, vp<[[LANEMASK_PHI]]>
+; VPLANS-NEXT: WIDEN store ir<%gep>, ir<%val> (mask vp<[[LANEMASK_PHI]]>)
; VPLANS-NEXT: EMIT vp<[[INC:%[0-9]+]]> = VF * Part + vp<[[INDV]]>
; VPLANS-NEXT: EMIT vp<[[LANEMASK_LOOP]]> = active lane mask vp<[[INC]]>, vp<[[NEWTC]]>
; VPLANS-NEXT: EMIT vp<[[INDV_UPDATE:%[0-9]+]]> = VF * UF + vp<[[INDV]]>
Index: llvm/lib/Transforms/Vectorize/VPlanValue.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -215,11 +215,6 @@
VPUserID ID;
protected:
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
- /// Print the operands to \p O.
- void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const;
-#endif
-
VPUser(ArrayRef<VPValue *> Operands, VPUserID ID) : ID(ID) {
for (VPValue *Operand : Operands)
addOperand(Operand);
Index: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -227,6 +227,20 @@
insertBefore(BB, I);
}
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+void VPRecipeBase::printOperands(raw_ostream &O,
+ VPSlotTracker &SlotTracker) const {
+ interleaveComma(operands_without_mask(), O, [&O, &SlotTracker](VPValue *Op) {
+ Op->printAsOperand(O, SlotTracker);
+ });
+ if (isMasked()) {
+ O << " (mask ";
+ getMask()->printAsOperand(O, SlotTracker);
+ O << ")";
+ }
+}
+#endif
+
FastMathFlags VPRecipeWithIRFlags::getFastMathFlags() const {
assert(OpType == OperationType::FPMathOp &&
"recipe doesn't have fast math flags");
Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ llvm/lib/Transforms/Vectorize/VPlan.h
@@ -806,6 +806,16 @@
// Mask is optional and therefore the last operand.
return isMasked() ? getOperand(getNumOperands() - 1) : nullptr;
}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+ /// Print the operands to \p O.
+ void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const;
+#endif
+
+ const_operand_range operands_without_mask() const {
+ auto End = isMasked() ? op_end() - 1 : op_end();
+ return const_operand_range(op_begin(), End);
+ }
};
// Helper macro to define common classof implementations for recipes.
Index: llvm/lib/Transforms/Vectorize/VPlan.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1148,12 +1148,6 @@
else
OS << "vp<%" << Tracker.getSlot(this) << ">";
}
-
-void VPUser::printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const {
- interleaveComma(operands(), O, [&O, &SlotTracker](VPValue *Op) {
- Op->printAsOperand(O, SlotTracker);
- });
-}
#endif
void VPInterleavedAccessInfo::visitRegion(VPRegionBlock *Region,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157443.548361.patch
Type: text/x-patch
Size: 3735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230808/9df40d77/attachment.bin>
More information about the llvm-commits
mailing list