[llvm] e61de01 - [VPlan] Check enclosing region first (NFC). (#216676)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 02:14:09 PDT 2026


Author: Florian Hahn
Date: 2026-08-18T10:14:04+01:00
New Revision: e61de014c35d7bc5291dcecad4c052642fca02f3

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

LOG: [VPlan] Check enclosing region first (NFC). (#216676)

Check cheaper getEnclosingLoopRegion() first; it only walks the parent
chain, while getVectorLoopRegion() traverses the plan's top-level
blocks.

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 f077932cf7217..87d24ed9d8d4b 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1485,8 +1485,8 @@ static bool isDefinedInsideLoopRegions(const VPValue *VPV) {
   if (isa<VPRegionValue>(VPV))
     return true;
   const VPRecipeBase *DefR = VPV->getDefiningRecipe();
-  return DefR && (!DefR->getParent()->getPlan()->getVectorLoopRegion() ||
-                  DefR->getParent()->getEnclosingLoopRegion());
+  return DefR && (DefR->getParent()->getEnclosingLoopRegion() ||
+                  !DefR->getParent()->getPlan()->getVectorLoopRegion());
 }
 
 bool VPValue::isDefinedOutsideLoopRegions() const {


        


More information about the llvm-commits mailing list