[llvm] 29712cc - [VPlan] Assert instead of check if VF is vector when widening casts.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 01:02:58 PDT 2023


Author: Florian Hahn
Date: 2023-05-05T09:02:33+01:00
New Revision: 29712ccda62012e615b8c55bc6a3fa7454c10c42

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

LOG: [VPlan] Assert instead of check if VF is vector when widening casts.

VPWidenRecipes should not be generated for scalar VFs. Replace check
with an assert. Suggested in preparation for D149081.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
index 849f3f8f5cc1e..4f3e527efcf90 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp
@@ -701,9 +701,8 @@ void VPWidenRecipe::execute(VPTransformState &State) {
     State.setDebugLocFromInst(CI);
 
     /// Vectorize casts.
-    Type *DestTy = (State.VF.isScalar())
-                       ? CI->getType()
-                       : VectorType::get(CI->getType(), State.VF);
+    assert(State.VF.isVector() && "not widening");
+    Type *DestTy = VectorType::get(CI->getType(), State.VF);
 
     for (unsigned Part = 0; Part < State.UF; ++Part) {
       Value *A = State.get(getOperand(0), Part);


        


More information about the llvm-commits mailing list