[llvm] [VPlan] Model FOR resume value extraction in VPlan. (PR #93396)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 5 02:43:37 PDT 2024
================
@@ -847,14 +847,84 @@ bool VPlanTransforms::adjustFixedOrderRecurrences(VPlan &Plan,
// all users.
RecurSplice->setOperand(0, FOR);
+ // This is the second phase of vectorizing first-order recurrences. An
+ // overview of the transformation is described below. Suppose we have the
+ // following loop.
+ //
+ // for (int i = 0; i < n; ++i)
+ // b[i] = a[i] - a[i - 1];
+ //
+ // There is a first-order recurrence on "a". For this loop, the shorthand
+ // scalar IR looks like:
+ //
+ // scalar.ph:
+ // s_init = a[-1]
+ // br scalar.body
+ //
+ // scalar.body:
+ // i = phi [0, scalar.ph], [i+1, scalar.body]
+ // s1 = phi [s_init, scalar.ph], [s2, scalar.body]
+ // s2 = a[i]
+ // b[i] = s2 - s1
+ // br cond, scalar.body, ...
+ //
----------------
fhahn wrote:
Added, thanks!
https://github.com/llvm/llvm-project/pull/93396
More information about the llvm-commits
mailing list