[flang-commits] [clang-tools-extra] [flang] [libc] [compiler-rt] [libcxx] [clang] [llvm] [mlir] [VPlan] Replace VPRecipeOrVPValue with VP2VP recipe simplification. (PR #76090)

Florian Hahn via flang-commits flang-commits at lists.llvm.org
Mon Jan 29 01:34:21 PST 2024


================
@@ -9058,6 +9026,20 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
         LinkVPBB->insert(FMulRecipe, CurrentLink->getIterator());
         VecOp = FMulRecipe;
       } else {
+        auto *Blend = dyn_cast<VPBlendRecipe>(CurrentLink);
+        if (PhiR->isInLoop() && Blend) {
+          assert(Blend->getNumIncomingValues() == 2 &&
+                 "Blend must have 2 incoming values");
+          if (Blend->getIncomingValue(0) == PhiR)
+            Blend->replaceAllUsesWith(Blend->getIncomingValue(1));
+          else {
+            Blend->replaceAllUsesWith(Blend->getIncomingValue(0));
+            assert(Blend->getIncomingValue(1) == PhiR &&
+                   "PhiR must be an operand of the blend");
----------------
fhahn wrote:

Done, thanks!

https://github.com/llvm/llvm-project/pull/76090


More information about the flang-commits mailing list