[llvm] [VPlan] Replace VPRegionBlock with explicit CFG before execute (NFCI). (PR #117506)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 06:02:21 PDT 2025


================
@@ -1365,17 +1397,18 @@ void VPlanPrinter::dumpRegion(const VPRegionBlock *Region) {
 
 #endif
 
-/// Returns true if there is a vector loop region and \p VPV is defined in a
-/// loop region.
-static bool isDefinedInsideLoopRegions(const VPValue *VPV) {
-  const VPRecipeBase *DefR = VPV->getDefiningRecipe();
-  return DefR && (!DefR->getParent()->getPlan()->getVectorLoopRegion() ||
-                  DefR->getParent()->getEnclosingLoopRegion());
-}
+bool VPValue::isDefinedOutsideLoop() const {
+  auto *DefR = getDefiningRecipe();
+  if (!DefR)
+    return true;
 
-bool VPValue::isDefinedOutsideLoopRegions() const {
-  return !isDefinedInsideLoopRegions(this);
+  // For non-live-ins, check if is in a region only if the top-level loop region
+  // still exits.
+  const VPBasicBlock *DefVPBB = DefR->getParent();
+  auto *Plan = DefVPBB->getPlan();
+  return Plan->getVectorLoopRegion() && !DefVPBB->getEnclosingLoopRegion();
----------------
fhahn wrote:

Ah yes, messed something up on my side when trying to restore, should be done now. Still kept the new name `isDefinedOutsideLoop`.

I've not adjusted the name of `isDefinedInsideLoopRegions` yet, as it's code is now not touched in the PR. can do separately or pull in here.

https://github.com/llvm/llvm-project/pull/117506


More information about the llvm-commits mailing list