[llvm] [VPlan] Implement interleaving as VPlan-to-VPlan transform. (PR #95842)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 03:15:25 PDT 2024


================
@@ -3665,6 +3690,29 @@ inline bool isUniformAfterVectorization(VPValue *VPV) {
     return VPI->isVectorToScalar();
   return false;
 }
+
+/// Checks if \p C is uniform across all VFs and UFs. It is considered as such
+/// if it is either defined outside the vector region or its operand is known to
+/// be uniform across all VFs and UFs (e.g. VPDerivedIV or VPCanonicalIVPHI).
+inline bool isUniformAcrossVFsAndUFs(VPValue *V) {
----------------
ayalz wrote:

```suggestion
inline bool isUniformAcrossVFsAndUFs(VPValue *V) {
  // Loop invariants are uniform:
  if (V->isDefinedOutsideVectorRegions())
    return true;
  auto *R = V->getDefiningRecipe();
    
  // Canonical IV chain is uniform:
  auto *CanonicalIV = R->getParent()->getPlan()->getCanonicalIV();
  if (R == CanonicalIV || R == CanonicalIV->getBackedgeValue())
    return true;

  // DerivedIV is uniform:
  if (isa<VPDerivedIVRecipe>(R))
    return true;
```

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


More information about the llvm-commits mailing list