git: 91ec809f0a90 - main - Apply llvm fix for assertion/crash building math/vtk

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Tue, 27 Sep 2022 21:46:22 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=91ec809f0a90798296697cfc9afdb1c50c6d4971

commit 91ec809f0a90798296697cfc9afdb1c50c6d4971
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-09-27 21:45:56 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-09-27 21:45:56 +0000

    Apply llvm fix for assertion/crash building math/vtk
    
    Merge commit 307ace7f20d5 from llvm git (by David Sherwood):
    
      [LoopVectorize] Ensure the VPReductionRecipe is placed after all it's inputs
    
      When vectorising ordered reductions we call a function
      LoopVectorizationPlanner::adjustRecipesForReductions to replace the
      existing VPWidenRecipe for the fadd instruction with a new
      VPReductionRecipe. We attempt to insert the new recipe in the same
      place, but this is wrong because createBlockInMask may have
      generated new recipes that VPReductionRecipe now depends upon. I
      have changed the insertion code to append the recipe to the
      VPBasicBlock instead.
    
      Added a new RUN with tail-folding enabled to the existing test:
    
        Transforms/LoopVectorize/AArch64/scalable-strict-fadd.ll
    
      Differential Revision: https://reviews.llvm.org/D129550
    
    Reported by:    yuri
    PR:             264834
    MFC after:      3 days
---
 contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 0fdcb8be59ac..51d2c6237af1 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9453,7 +9453,9 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
       WidenRecipe->getVPSingleValue()->replaceAllUsesWith(RedRecipe);
       Plan->removeVPValueFor(R);
       Plan->addVPValue(R, RedRecipe);
-      WidenRecipe->getParent()->insert(RedRecipe, WidenRecipe->getIterator());
+      // Append the recipe to the end of the VPBasicBlock because we need to
+      // ensure that it comes after all of it's inputs, including CondOp.
+      WidenRecipe->getParent()->appendRecipe(RedRecipe);
       WidenRecipe->getVPSingleValue()->replaceAllUsesWith(RedRecipe);
       WidenRecipe->eraseFromParent();