[llvm] [VPlan] Remove loop region in optimizeForVFAndUF. (PR #108378)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 06:05:48 PST 2025


================
@@ -1399,11 +1406,17 @@ void VPlanIngredient::print(raw_ostream &O) const {
 
 #endif
 
-bool VPValue::isDefinedOutsideLoopRegions() const {
-  return !hasDefiningRecipe() ||
-         !getDefiningRecipe()->getParent()->getEnclosingLoopRegion();
+/// 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::isDefinedOutsideLoopRegions() const {
+  return !isDefinedInsideLoopRegions(this);
+}
----------------
ayalz wrote:

post-commit nit:
```suggestion
}

```

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


More information about the llvm-commits mailing list