[llvm] [VPlan] Dispatch to multiple exit blocks via middle blocks. (PR #112138)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 02:32:00 PST 2024


================
@@ -1069,7 +1066,10 @@ void VPlan::execute(VPTransformState *State) {
       // Move the last step to the end of the latch block. This ensures
       // consistent placement of all induction updates.
       Instruction *Inc = cast<Instruction>(Phi->getIncomingValue(1));
-      Inc->moveBefore(VectorLatchBB->getTerminator()->getPrevNode());
+      if (VectorLatchBB->getTerminator() == &*VectorLatchBB->getFirstNonPHI())
+        Inc->moveBefore(VectorLatchBB->getTerminator());
+      else
+        Inc->moveBefore(VectorLatchBB->getTerminator()->getPrevNode());
----------------
ayalz wrote:

Worth extending the comment?

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


More information about the llvm-commits mailing list