[PATCH] D71964: [LV] Use getMask() when printing recipe

Gil Rapaport via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 28 09:39:54 PST 2019


gilr created this revision.
gilr added a reviewer: Ayal.
Herald added subscribers: llvm-commits, rogfer01, rkruppe, hiraditya.
Herald added a project: LLVM.

Use dedicated API for getting the mask instead of duplicating it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71964

Files:
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h


Index: llvm/lib/Transforms/Vectorize/VPlan.h
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.h
+++ llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1015,7 +1015,7 @@
 
   /// Return the mask used by this recipe. Note that a full mask is represented
   /// by a nullptr.
-  VPValue *getMask() {
+  VPValue *getMask() const {
     // Mask is the last operand.
     return User ? User->getOperand(User->getNumOperands() - 1) : nullptr;
   }
Index: llvm/lib/Transforms/Vectorize/VPlan.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -735,9 +735,10 @@
 void VPWidenMemoryInstructionRecipe::print(raw_ostream &O,
                                            const Twine &Indent) const {
   O << " +\n" << Indent << "\"WIDEN " << VPlanIngredient(&Instr);
-  if (User) {
+  VPValue *Mask = getMask();
+  if (Mask) {
     O << ", ";
-    User->getOperand(0)->printAsOperand(O);
+    Mask->printAsOperand(O);
   }
   O << "\\l\"";
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71964.235480.patch
Type: text/x-patch
Size: 1091 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191228/cb35274a/attachment.bin>


More information about the llvm-commits mailing list