[PATCH] D21330: Loop vectorization with FP induction variables
Elena Demikhovsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 19 05:04:31 PDT 2016
delena marked 3 inline comments as done.
================
Comment at: ../include/llvm/Transforms/Utils/LoopUtils.h:274
@@ -273,1 +273,3 @@
+ : StartValue(nullptr), IK(IK_NoInduction), Step(nullptr),
+ UnsafeAlgebraInst(nullptr), BinaryOp((Instruction::BinaryOps)0) {}
----------------
mkuper wrote:
> I think Instruction::BinaryOpsEnd may be better for an explicitly invalid BinaryOp. Not sure that's a good choice, but pretty sure 0 isn't.
Thanks, I'll fix.
================
Comment at: ../lib/Transforms/Vectorize/LoopVectorize.cpp:6405
@@ +6404,3 @@
+
+ // Floating point operations had to be 'fast' to enable the unrolling.
+ FastMathFlags Flags;
----------------
mkuper wrote:
> Are you sure about this? I mean, it's true for vectorizing, but is it true here as well?
> (I'm not saying it isn't, just making sure this is intentional)
Even if you have only unrolling, and VF is 1, the value of FP induction is calculated as:
sitofp(PrimaryIV) * Increment.
for (int i=0; i<N; i++) {
fp_ind += fp_inc;
}
is transferred to something like this:
init = fp_inc;
for (int i=0; i<N; i++) {
fp_ind = init + i*fp_inc;
}
In this case we need unsafe math.
I added tests for unrolling.
Repository:
rL LLVM
https://reviews.llvm.org/D21330
More information about the llvm-commits
mailing list