[llvm-branch-commits] [llvm] [VPlan] Explicitly handle scalar pointer inductions. (PR #80273)
Florian Hahn via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Feb 7 14:05:28 PST 2024
================
@@ -489,6 +490,23 @@ Value *VPInstruction::generateInstruction(VPTransformState &State,
return ReducedPartRdx;
}
+ case VPInstruction::PtrAdd: {
+ if (vputils::onlyFirstLaneUsed(this)) {
+ auto *P = Builder.CreatePtrAdd(
+ State.get(getOperand(0), VPIteration(Part, 0)),
+ State.get(getOperand(1), VPIteration(Part, 0)), Name);
+ State.set(this, P, VPIteration(Part, 0));
+ } else {
+ for (unsigned Lane = 0; Lane != State.VF.getKnownMinValue(); ++Lane) {
+ Value *P = Builder.CreatePtrAdd(
+ State.get(getOperand(0), VPIteration(Part, Lane)),
+ State.get(getOperand(1), VPIteration(Part, Lane)), Name);
+
+ State.set(this, P, VPIteration(Part, Lane));
+ }
+ }
+ return nullptr;
----------------
fhahn wrote:
Updated to split into generate for scalars (per lane, possibly optimizing depending on onlyFirstLaneUseD) and generate for vectors (per-part)
Some of it could be done separately or as part of https://github.com/llvm/llvm-project/pull/80271, but would be good to agree on the overall structure first then land separately as makes sense.
https://github.com/llvm/llvm-project/pull/80273
More information about the llvm-branch-commits
mailing list