[llvm] 0867a9e - [VPlan] Use isa<> instead of directly checking VPRecipeID (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 09:48:19 PDT 2020


Author: Florian Hahn
Date: 2020-10-02T17:47:35+01:00
New Revision: 0867a9e85ace8ed0b11f6a7fc4c9e4bb1606263b

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

LOG: [VPlan] Use isa<> instead of directly checking VPRecipeID (NFC).

getVPRecipeID is intended to be only used in `classof` helpers. Instead
of checking it directly, use isa<> with the correct recipe type.

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 73ac508c389a..d54a890a3ce2 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -7889,11 +7889,11 @@ void LoopVectorizationPlanner::adjustRecipesForInLoopReductions(
       unsigned FirstOpId;
       if (Kind == RecurrenceDescriptor::RK_IntegerMinMax ||
           Kind == RecurrenceDescriptor::RK_FloatMinMax) {
-        assert(WidenRecipe->getVPRecipeID() == VPRecipeBase::VPWidenSelectSC &&
+        assert(isa<VPWidenSelectRecipe>(WidenRecipe) &&
                "Expected to replace a VPWidenSelectSC");
         FirstOpId = 1;
       } else {
-        assert(WidenRecipe->getVPRecipeID() == VPRecipeBase::VPWidenSC &&
+        assert(isa<VPWidenRecipe>(WidenRecipe) &&
                "Expected to replace a VPWidenSC");
         FirstOpId = 0;
       }
@@ -7910,7 +7910,7 @@ void LoopVectorizationPlanner::adjustRecipesForInLoopReductions(
           Kind == RecurrenceDescriptor::RK_FloatMinMax) {
         VPRecipeBase *CompareRecipe =
             RecipeBuilder.getRecipe(cast<Instruction>(R->getOperand(0)));
-        assert(CompareRecipe->getVPRecipeID() == VPRecipeBase::VPWidenSC &&
+        assert(isa<VPWidenRecipe>(CompareRecipe) &&
                "Expected to replace a VPWidenSC");
         CompareRecipe->eraseFromParent();
       }


        


More information about the llvm-commits mailing list