[llvm] [VPlan] Explicitly handle scalar pointer inductions. (PR #83068)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 11 06:57:35 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) {
----------------
fhahn wrote:

Updated roughly as suggested. also updated to check if only a scalar is needed for the first lane and a scalar can be generated (set to `OnlyGenerateFirstLane`).

This allows delegating to `generatePerPart` from `generatePerLane`, for cases not handled there (all except PtrAdd). This is a consequence of having ocpodes that may generate a vector or scalar per part,  sharing codegen for both.

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


More information about the llvm-commits mailing list