[llvm] [VPlan] Explicitly handle scalar pointer inductions. (PR #83068)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 10 16:55:08 PDT 2024
================
@@ -515,15 +536,32 @@ void VPInstruction::execute(VPTransformState &State) {
if (hasFastMathFlags())
State.Builder.setFastMathFlags(getFastMathFlags());
for (unsigned Part = 0; Part < State.UF; ++Part) {
- Value *GeneratedValue = generateInstruction(State, Part);
+ bool OnlyFirstLaneDefined =
+ vputils::onlyFirstLaneUsed(this) ||
+ getOpcode() == VPInstruction::ComputeReductionResult;
+ if (doesGenerateScalars()) {
+ if (OnlyFirstLaneDefined) {
+ Value *P = generatePerLane(State, VPIteration(Part, 0));
+ State.set(this, P, Part, /*IsScalar*/ true);
+ continue;
+ }
+
+ for (unsigned Lane = 0, NumLanes = State.VF.getKnownMinValue();
+ Lane != NumLanes; ++Lane) {
+ Value *P = generatePerLane(State, VPIteration(Part, Lane));
+ State.set(this, P, VPIteration(Part, Lane));
+ }
+ continue;
+ }
+
+ Value *GeneratedValue = generatePerPart(State, Part);
if (!hasResult())
continue;
assert(GeneratedValue && "generateInstruction must produce a value");
bool IsVector = GeneratedValue->getType()->isVectorTy();
----------------
ayalz wrote:
Confusion above cont'd: if (doesGenerateScalars()) above took care of scalars, IsVector here is expected to be true. But for ComputeReductionResult, e.g..
https://github.com/llvm/llvm-project/pull/83068
More information about the llvm-commits
mailing list