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

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 07:30:40 PST 2024


================
@@ -509,7 +530,19 @@ void VPInstruction::execute(VPTransformState &State) {
   if (hasFastMathFlags())
     State.Builder.setFastMathFlags(getFastMathFlags());
   for (unsigned Part = 0; Part < State.UF; ++Part) {
-    Value *GeneratedValue = generateInstruction(State, Part);
+    if (generatesScalars()) {
+      unsigned NumLanes =
+          vputils::onlyFirstLaneUsed(this) ? 1 : State.VF.getKnownMinValue();
+      if (getOpcode() == VPInstruction::ComputeReductionResult)
----------------
ayalz wrote:

Can be folded to assign NumLanes once.

Would it help to fold onlyFirstLaneUsed(this) with opcode == ComputeReductionResult, here and below, and if so - how would it be called - onlySingleLaneDefined?

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


More information about the llvm-commits mailing list