[llvm] bcc9c5d - [LV] Replace unnecessary cast_or_null with cast (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 14:32:25 PST 2022


Author: Florian Hahn
Date: 2022-11-16T22:31:59Z
New Revision: bcc9c5d959b9cdfbb535ea298805c4993cf0bb64

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

LOG: [LV] Replace unnecessary cast_or_null with cast (NFC).

The existing code already unconditionally dereferences RepR, so
cast_or_null can be replaced by just cast.

Suggested by @Ayal during review of D136068, thanks!

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 a1878a6c1a0a..ab882acb1aeb 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8483,7 +8483,7 @@ VPBasicBlock *VPRecipeBuilder::handleReplication(
         dyn_cast_or_null<VPPredInstPHIRecipe>(Op->getDefiningRecipe());
     if (!PredR)
       continue;
-    auto *RepR = cast_or_null<VPReplicateRecipe>(
+    auto *RepR = cast<VPReplicateRecipe>(
         PredR->getOperand(0)->getDefiningRecipe());
     assert(RepR->isPredicated() &&
            "expected Replicate recipe to be predicated");


        


More information about the llvm-commits mailing list