[PATCH] D107223: [VPlan] Use defined and ops VPValues to print VPInterleaveRecipe.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 1 23:13:25 PDT 2021


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9552
+  unsigned OpIdx = 0;
+  for (unsigned i = 0; i < IG->getFactor(); ++i) {
+    if (!IG->getMember(i))
----------------
Would have been nice to iterate over the recipe's operands and/or def VPValues, instead of calling getOperand()/getVPValue() for each, but the former does not tell where the gaps are.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:1330
+  /// Returns true if this is a store interleave group.
+  bool isStore() const { return getNumOperands() > (HasMask ? 2 : 1); }
 };
----------------
How about checking instead if the number of store operands is positive using
`int getNumStoreOperands() const { return getNumOperands() - (HasMask ? 2 : 1); }`
This can also serve getStoredValues(), so that isStore() isn't only an ifndef NDEBUG thing for printing.
Can alternatively have the constructor initialize a constant field, as the number of store operands does not change. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107223/new/

https://reviews.llvm.org/D107223



More information about the llvm-commits mailing list