LoopVectorize: Use the widest induction variable type
authorArnold Schwaighofer <aschwaighofer@apple.com>
Sat, 11 May 2013 23:04:28 +0000 (23:04 +0000)
committerArnold Schwaighofer <aschwaighofer@apple.com>
Sat, 11 May 2013 23:04:28 +0000 (23:04 +0000)
commit9b5d70f07630f99f1ec5589aeaba96c6d8ab0aee
tree7a6c6cc63565a5ad554578a33d5b854c723c0830
parent6bb539a643b385520c25f3b03199f68012b9c09b
LoopVectorize: Use the widest induction variable type

Use the widest induction type encountered for the cannonical induction variable.

We used to turn the following loop into an empty loop because we used i8 as
induction variable type and truncated 1024 to 0 as trip count.

int a[1024];
void fail() {
  int reverse_induction = 1023;
  unsigned char forward_induction = 0;
  while ((reverse_induction) >= 0) {
    forward_induction++;
    a[reverse_induction] = forward_induction;
    --reverse_induction;
  }
}

radar://13862901

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181667 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/reverse_induction.ll