[llvm] 7737c05 - [VPlan] Make sure properlyDominates(A, A) returns false.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 19 10:01:42 PST 2023


Author: Florian Hahn
Date: 2023-02-19T18:01:16Z
New Revision: 7737c0569660f2ea8edce8d3ea7276602b3a8552

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

LOG: [VPlan] Make sure properlyDominates(A, A) returns false.

At the moment, properlyDominates(A, A) can return true via
LocalComesBefore. Add an early exit to ensure it returns false if
A == B.

Note: no test has been added because the existing test suite covers this
case already with libc++ with assertions enabled.

Fixes https://github.com/llvm/llvm-project/issues/60850.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 568f9ab095e5c..d3f84dade4715 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -551,6 +551,9 @@ static VPRegionBlock *GetReplicateRegion(VPRecipeBase *R) {
 
 static bool properlyDominates(const VPRecipeBase *A, const VPRecipeBase *B,
                               VPDominatorTree &VPDT) {
+  if (A == B)
+    return false;
+
   auto LocalComesBefore = [](const VPRecipeBase *A, const VPRecipeBase *B) {
     for (auto &R : *A->getParent()) {
       if (&R == A)


        


More information about the llvm-commits mailing list