[PATCH] D21330: Loop vectorization with FP induction variables

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 11:57:24 PDT 2016


anemet added a comment.

So with these it should LGTM too.  I haven't checked everything (most notably the unsafe math part).

I just wanted to see whether this was in line with the direction set in the original llvm-dev thread and it is!  Thanks to all of you and sorry about the delay again.


================
Comment at: ../lib/Transforms/Utils/LoopUtils.cpp:816-818
@@ +815,5 @@
+  // on function level.
+  Instruction *UAI = !BOp->hasUnsafeAlgebra() ? BOp : nullptr;
+  D = InductionDescriptor(StartValue, IK_FpInduction, Step, UAI,
+                          BOp->getOpcode());
+  return true;
----------------
I think that a better interface would be to take BOp (step instruction) optionally and then derive DI::hasUnsafeAlgebra and the opcode from that.  This is OK as a follow-up if you prefer.

================
Comment at: ../lib/Transforms/Vectorize/LoopVectorize.cpp:4104-4105
@@ +4103,4 @@
+    Value *Broadcasted = getBroadcastInstrs(V);
+    // After broadcasting the induction variable we need to make the vector
+    // consecutive by adding 0, 1, 2, etc.
+    Value *StepVal = cast<SCEVUnknown>(II.getStep())->getValue();
----------------
by adding StepVal, you mean


Repository:
  rL LLVM

https://reviews.llvm.org/D21330





More information about the llvm-commits mailing list