git: 836d47d38e0a - main - Apply llvm fix for assertion/crash building archivers/c-blosc2

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Fri, 01 Jul 2022 23:16:10 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=836d47d38e0a586c9b307fd7fb46bf563acba151

commit 836d47d38e0a586c9b307fd7fb46bf563acba151
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-07-01 23:13:46 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-07-01 23:13:46 +0000

    Apply llvm fix for assertion/crash building archivers/c-blosc2
    
    Merge commit 88ce403c6aab from llvm git (by Florian Hahn):
    
      [LV] Add new block to place recurrence splice, if needed.
    
      In some cases, a recurrence splice instructions needs to be inserted
      between to regions, for example if the regions get re-arranged during
      sinking.
    
      Fixes #56146.
    
    PR:             264979
    Reported by:    Robert Clausecker <fuz@fuz.su>
    MFC after:      3 days
---
 .../llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp    | 6 +++++-
 1 file changed, 5 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 46ff0994e04e..0fdcb8be59ac 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9266,7 +9266,11 @@ VPlanPtr LoopVectorizationPlanner::buildVPlanWithVPRecipes(
     VPBasicBlock *InsertBlock = PrevRecipe->getParent();
     auto *Region = GetReplicateRegion(PrevRecipe);
     if (Region)
-      InsertBlock = cast<VPBasicBlock>(Region->getSingleSuccessor());
+      InsertBlock = dyn_cast<VPBasicBlock>(Region->getSingleSuccessor());
+    if (!InsertBlock) {
+      InsertBlock = new VPBasicBlock(Region->getName() + ".succ");
+      VPBlockUtils::insertBlockAfter(InsertBlock, Region);
+    }
     if (Region || PrevRecipe->isPhi())
       Builder.setInsertPoint(InsertBlock, InsertBlock->getFirstNonPhi());
     else