[llvm] 033a97a - [LV] Minor code restructure of isUniformAfterVectorization [nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 12:48:45 PDT 2022


Author: Philip Reames
Date: 2022-08-29T12:48:27-07:00
New Revision: 033a97a8f3f808d9e8059f534ddaaa792bc8f095

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

LOG: [LV] Minor code restructure of isUniformAfterVectorization [nfc]

Mostly just to make a future patch easier to review.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 533ad295b732..d82bf7e670e8 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -3048,8 +3048,13 @@ VPValue *getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr,
 
 /// Returns true if \p VPV is uniform after vectorization.
 inline bool isUniformAfterVectorization(VPValue *VPV) {
-  auto RepR = dyn_cast_or_null<VPReplicateRecipe>(VPV->getDef());
-  return !VPV->getDef() || (RepR && RepR->isUniform());
+  if (auto *Def = VPV->getDef()) {
+    if (auto Rep = dyn_cast<VPReplicateRecipe>(Def))
+      return Rep->isUniform();
+    return false;
+  }
+  // A value without a def is external to vplan and thus uniform.
+  return true;
 }
 } // end namespace vputils
 


        


More information about the llvm-commits mailing list