[llvm] 091c5c9 - [VPlan] Add printOperands helper to VPUser (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 04:32:15 PST 2020
Author: Florian Hahn
Date: 2020-11-09T12:30:57Z
New Revision: 091c5c9a187f656a62f28b6c43d25bfb25c9107e
URL: https://github.com/llvm/llvm-project/commit/091c5c9a187f656a62f28b6c43d25bfb25c9107e
DIFF: https://github.com/llvm/llvm-project/commit/091c5c9a187f656a62f28b6c43d25bfb25c9107e.diff
LOG: [VPlan] Add printOperands helper to VPUser (NFC).
Factor out the code for printing operands of a VPUser so it can be
re-used when printing other recipes.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.cpp
llvm/lib/Transforms/Vectorize/VPlanValue.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 95f9b141b277..4a3ad0e1eaae 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -915,13 +915,7 @@ void VPWidenMemoryInstructionRecipe::print(raw_ostream &O, const Twine &Indent,
O << "\"WIDEN "
<< Instruction::getOpcodeName(getUnderlyingInstr()->getOpcode()) << " ";
- bool First = true;
- for (VPValue *Op : operands()) {
- if (!First)
- O << ", ";
- Op->printAsOperand(O, SlotTracker);
- First = false;
- }
+ printOperands(O, SlotTracker);
}
void VPWidenCanonicalIVRecipe::execute(VPTransformState &State) {
@@ -988,6 +982,16 @@ void VPValue::printAsOperand(raw_ostream &OS, VPSlotTracker &Tracker) const {
OS << "vp<%" << Tracker.getSlot(this) << ">";
}
+void VPUser::printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const {
+ bool First = true;
+ for (VPValue *Op : operands()) {
+ if (!First)
+ O << ", ";
+ Op->printAsOperand(O, SlotTracker);
+ First = false;
+ }
+}
+
void VPInterleavedAccessInfo::visitRegion(VPRegionBlock *Region,
Old2NewTy &Old2New,
InterleavedAccessInfo &IAI) {
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index ba9228534a22..f18b6f94c986 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -157,6 +157,10 @@ raw_ostream &operator<<(raw_ostream &OS, const VPValue &V);
class VPUser {
SmallVector<VPValue *, 2> Operands;
+protected:
+ /// Print the operands to \p O.
+ void printOperands(raw_ostream &O, VPSlotTracker &SlotTracker) const;
+
public:
VPUser() {}
VPUser(ArrayRef<VPValue *> Operands) {
More information about the llvm-commits
mailing list