[PATCH] [LoopVectorize] Induction variables: support arbitrary constant step
Hao Liu
Hao.Liu at arm.com
Tue Jan 27 23:23:59 PST 2015
Hi,
According to the comments, a new patch has been attached.
Review, please.
Thanks,
-Hao
================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:722
@@ +721,3 @@
+ /// For pointer induction, returns StartValue[Index * StepValue].
+ Value *transform(IRBuilder<> &B, Value *Index) const {
+ switch (IK) {
----------------
hfinkel wrote:
> aschwaighofer wrote:
> > hfinkel wrote:
> > > Given that we don't vectorize loops with wrap-around index spaces, as far as I know, we should be able to add nsw (or nuw or both) flags on these operations. Please do so when possible.
> > Hal, I don't think this is safe. Consider the following example. The canonical induction variable does not wrap but the derived one does.
> >
> > int test(int *a) {
> > int r = 0;
> > uint64_t idx2=0;
> > for (uint64_t i = 0 ; i < UINT64_MAX; ++i) {
> > r+=a[idx2];
> > idx2 += 2;
> > }
> > return r;
> > }
> Agreed. But shouldn't we be able to get the nsw/nuw flags from the original scalar operation?
>
> (If so, but this departs too far from the scope of this patch, I'm fine with adding a FIXME and leaving this for follow-up)
>
Agree with you two. Several FIXMEs have been added.
================
Comment at: test/Transforms/LoopVectorize/arbitrary-induction-step.ll:7
@@ +6,3 @@
+
+; CHECK: LV: Checking a loop in "ind_plus2"
+; CHECK: LV: Did not find one integer induction var.
----------------
hfinkel wrote:
> If you're checking debug output, you'll need to add:
>
> ; REQUIRES: asserts
>
> to the entire test. Please break this out into a separate test file, if you'd like to do this, to limit the reduction in test coverage for non-asserts builds.
Hal, thanks for let me know about this.
As I think it's not worth to add another file just for testing the debug info, I remove such 'CHECK' and '-debug-only'.
http://reviews.llvm.org/D7193
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list