[llvm] 2a9aed1 - [LV] Retain mask-reversal comment as suggested after e5e71af.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 18 12:53:44 PST 2023


Author: Florian Hahn
Date: 2023-11-18T20:53:23Z
New Revision: 2a9aed17302c8363883a228d35f398110b575db3

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

LOG: [LV] Retain mask-reversal comment as suggested after e5e71af.

Address post-commit comment to retain comment.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 3b41939246b9946..295e25969663ca8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9561,13 +9561,16 @@ void VPWidenMemoryInstructionRecipe::execute(VPTransformState &State) {
   auto &Builder = State.Builder;
   InnerLoopVectorizer::VectorParts BlockInMaskParts(State.UF);
   bool isMaskRequired = getMask();
-  if (isMaskRequired)
+  if (isMaskRequired) {
+    // Mask reversal is only neede for non-all-one (null) masks, as reverse of a
+    // null all-one mask is a null mask.
     for (unsigned Part = 0; Part < State.UF; ++Part) {
       Value *Mask = State.get(getMask(), Part);
       if (isReverse())
         Mask = Builder.CreateVectorReverse(Mask, "reverse");
       BlockInMaskParts[Part] = Mask;
     }
+  }
 
   const auto CreateVecPtr = [&](unsigned Part, Value *Ptr) -> Value * {
     // Calculate the pointer for the specific unroll-part.


        


More information about the llvm-commits mailing list