[llvm] d62bf16 - [LV] Use getMask() when printing recipe [NFCI]

Gil Rapaport via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 28 23:05:33 PST 2019


Author: Gil Rapaport
Date: 2019-12-29T08:50:40+02:00
New Revision: d62bf16131e41bbe726646ac52e21b4bb38d305e

URL: https://github.com/llvm/llvm-project/commit/d62bf16131e41bbe726646ac52e21b4bb38d305e
DIFF: https://github.com/llvm/llvm-project/commit/d62bf16131e41bbe726646ac52e21b4bb38d305e.diff

LOG: [LV] Use getMask() when printing recipe [NFCI]

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

Differential Revision: https://reviews.llvm.org/D71964

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 654cb6dac07c..00571d059392 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -735,9 +735,10 @@ void VPPredInstPHIRecipe::print(raw_ostream &O, const Twine &Indent) const {
 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\"";
 }

diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 09af085faaf6..d35278332bef 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1015,7 +1015,7 @@ class VPWidenMemoryInstructionRecipe : public VPRecipeBase {
 
   /// 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;
   }


        


More information about the llvm-commits mailing list