[llvm] aa1a198 - [VPlan] Use isa<> instead getVPRecipeID in getFirstNonPhi (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 30 07:56:26 PDT 2020


Author: Florian Hahn
Date: 2020-10-30T14:56:06Z
New Revision: aa1a198a6405aeb1321fb3209bee787dc3415197

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

LOG: [VPlan] Use isa<> instead getVPRecipeID in getFirstNonPhi (NFC).

As per the comment in VPRecipeBase, clients should not rely on
getVPRecipeID, as it may change in the future. It should only be used in
classof implementations. Use isa instead in getFirstNonPhi.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index 5287c371f3cb..95f9b141b277 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -213,11 +213,10 @@ void VPBlockBase::deleteCFG(VPBlockBase *Entry) {
 
 VPBasicBlock::iterator VPBasicBlock::getFirstNonPhi() {
   iterator It = begin();
-  while (It != end() &&
-         (It->getVPRecipeID() == VPRecipeBase::VPWidenPHISC ||
-          It->getVPRecipeID() == VPRecipeBase::VPWidenIntOrFpInductionSC ||
-          It->getVPRecipeID() == VPRecipeBase::VPPredInstPHISC ||
-          It->getVPRecipeID() == VPRecipeBase::VPWidenCanonicalIVSC))
+  while (It != end() && (isa<VPWidenPHIRecipe>(&*It) ||
+                         isa<VPWidenIntOrFpInductionRecipe>(&*It) ||
+                         isa<VPPredInstPHIRecipe>(&*It) ||
+                         isa<VPWidenCanonicalIVRecipe>(&*It)))
     It++;
   return It;
 }


        


More information about the llvm-commits mailing list