[llvm] c7a7773 - [VPlan] Replace else-if dyn_cast with cast (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 11:46:44 PST 2024


Author: Florian Hahn
Date: 2024-12-23T19:46:22Z
New Revision: c7a777322dd8cc171cea9bbc8dbad14277b3587a

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

LOG: [VPlan] Replace else-if dyn_cast with cast (NFC).

The recipes handled here are either VPWidenIntrinsic or VPWidenCast, so
replace the else-if dyn_cast with a single else + cast.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 1689eadb5a5d7b..0b809c2b34df9e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -1488,12 +1488,14 @@ static VPRecipeBase *createEVLRecipe(VPValue *HeaderMask,
       })
       .Case<VPWidenIntrinsicRecipe, VPWidenCastRecipe>(
           [&](auto *CR) -> VPRecipeBase * {
-            Intrinsic::ID VPID = Intrinsic::not_intrinsic;
-            if (auto *CallR = dyn_cast<VPWidenIntrinsicRecipe>(CR))
+            Intrinsic::ID VPID;
+            if (auto *CallR = dyn_cast<VPWidenIntrinsicRecipe>(CR)) {
               VPID =
                   VPIntrinsic::getForIntrinsic(CallR->getVectorIntrinsicID());
-            else if (auto *CastR = dyn_cast<VPWidenCastRecipe>(CR))
+            } else {
+              auto *CastR = cast<VPWidenCastRecipe>(CR);
               VPID = VPIntrinsic::getForOpcode(CastR->getOpcode());
+            }
             assert(VPID != Intrinsic::not_intrinsic && "Expected VP intrinsic");
             assert(VPIntrinsic::getMaskParamPos(VPID) &&
                    VPIntrinsic::getVectorLengthParamPos(VPID) &&


        


More information about the llvm-commits mailing list