[llvm] 3717776 - [LV] Assert uniform recipes don't get predicated for when vectorizing.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 09:44:35 PDT 2024


Author: Florian Hahn
Date: 2024-07-18T17:43:51+01:00
New Revision: 371777695fe1b5407753ef2232d1b73014d3e501

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

LOG: [LV] Assert uniform recipes don't get predicated for when vectorizing.

Add assertion ensuring invariant on construction, split off as suggested
from https://github.com/llvm/llvm-project/pull/98892.

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 7ca798a8b2d89..748db418fee8c 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8578,6 +8578,12 @@ VPReplicateRecipe *VPRecipeBuilder::handleReplication(Instruction *I,
     BlockInMask = getBlockInMask(I->getParent());
   }
 
+  // Note that there is some custom logic to mark some intrinsics as uniform
+  // manually above for scalable vectors, which this assert needs to account for
+  // as well.
+  assert((Range.Start.isScalar() || !IsUniform || !IsPredicated ||
+          (Range.Start.isScalable() && isa<IntrinsicInst>(I))) &&
+         "Should not predicate a uniform recipe");
   auto *Recipe = new VPReplicateRecipe(I, mapToVPValues(I->operands()),
                                        IsUniform, BlockInMask);
   return Recipe;


        


More information about the llvm-commits mailing list