From 7737c0569660f2ea8edce8d3ea7276602b3a8552 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sun, 19 Feb 2023 18:01:15 +0000 Subject: [PATCH] [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. --- llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp index 568f9ab..d3f84da 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) -- 2.7.4