diff options
| author | James Molloy <james.molloy@arm.com> | 2015-09-02 10:14:54 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2015-09-02 10:14:54 +0000 |
| commit | c07701b017cc729a268f28f1e50fae32d331b615 (patch) | |
| tree | 34af1724d4ef5be610f9d58d8ae5537d56abadf6 /llvm/test/Transforms/LoopVectorize | |
| parent | d4b21935cccbde173a28c052cbb56a4bc7cfae02 (diff) | |
| download | bcm5719-llvm-c07701b017cc729a268f28f1e50fae32d331b615.tar.gz bcm5719-llvm-c07701b017cc729a268f28f1e50fae32d331b615.zip | |
[LV] Switch to using canonical induction variables.
Vectorized loops only ever have one induction variable. All induction PHIs from the scalar loop are rewritten to be in terms of this single indvar.
We were trying very hard to pick an indvar that already existed, even if that indvar wasn't canonical (didn't start at zero). But trying so hard is really fruitless - creating a new, canonical, indvar only results in one extra add in the worst case and that add is trivially easy to push through the PHI out of the loop by instcombine.
If we try and be less clever here and instead let instcombine clean up our mess (as we do in many other places in LV), we can remove unneeded complexity.
llvm-svn: 246630
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize')
| -rw-r--r-- | llvm/test/Transforms/LoopVectorize/induction.ll | 6 | ||||
| -rw-r--r-- | llvm/test/Transforms/LoopVectorize/reverse_induction.ll | 9 |
2 files changed, 5 insertions, 10 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/induction.ll b/llvm/test/Transforms/LoopVectorize/induction.ll index 48566ef92f7..f8017dd1106 100644 --- a/llvm/test/Transforms/LoopVectorize/induction.ll +++ b/llvm/test/Transforms/LoopVectorize/induction.ll @@ -6,8 +6,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 ; CHECK-LABEL: @multi_int_induction( ; CHECK: vector.body: ; CHECK: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] -; CHECK: %normalized.idx = sub i64 %index, 0 -; CHECK: %[[VAR:.*]] = trunc i64 %normalized.idx to i32 +; CHECK: %[[VAR:.*]] = trunc i64 %index to i32 ; CHECK: %offset.idx = add i32 190, %[[VAR]] define void @multi_int_induction(i32* %A, i32 %N) { for.body.lr.ph: @@ -142,11 +141,10 @@ define i32 @max_i32_backedgetaken() nounwind readnone ssp uwtable { ; CHECK-LABEL: testoverflowcheck ; CHECK: entry ; CHECK: %[[LOAD:.*]] = load i8 -; CHECK: %[[VAL:.*]] = zext i8 %[[LOAD]] to i32 ; CHECK: br ; CHECK: scalar.ph -; CHECK: phi i32 [ %{{.*}}, %middle.block ], [ %[[VAL]], %entry ] +; CHECK: phi i8 [ %{{.*}}, %middle.block ], [ %[[LOAD]], %entry ] @e = global i8 1, align 1 @d = common global i32 0, align 4 diff --git a/llvm/test/Transforms/LoopVectorize/reverse_induction.ll b/llvm/test/Transforms/LoopVectorize/reverse_induction.ll index 6b63a0d8db6..88dd2e4d66c 100644 --- a/llvm/test/Transforms/LoopVectorize/reverse_induction.ll +++ b/llvm/test/Transforms/LoopVectorize/reverse_induction.ll @@ -96,8 +96,7 @@ loopend: ; CHECK-LABEL: @reverse_forward_induction_i64_i8( ; CHECK: vector.body ; CHECK: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] -; CHECK: %normalized.idx = sub i64 %index, 0 -; CHECK: %offset.idx = sub i64 1023, %normalized.idx +; CHECK: %offset.idx = sub i64 1023, %index ; CHECK: trunc i64 %index to i8 define void @reverse_forward_induction_i64_i8() { @@ -122,10 +121,8 @@ while.end: ; CHECK-LABEL: @reverse_forward_induction_i64_i8_signed( ; CHECK: vector.body: -; CHECK: %index = phi i64 [ 129, %vector.ph ], [ %index.next, %vector.body ] -; CHECK: %normalized.idx = sub i64 %index, 129 -; CHECK: %offset.idx = sub i64 1023, %normalized.idx -; CHECK: trunc i64 %index to i8 +; CHECK: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] +; CHECK: %offset.idx = sub i64 1023, %index define void @reverse_forward_induction_i64_i8_signed() { entry: |

