diff options
author | Matthew Simpson <mssimpso@codeaurora.org> | 2017-02-10 16:15:26 +0000 |
---|---|---|
committer | Matthew Simpson <mssimpso@codeaurora.org> | 2017-02-10 16:15:26 +0000 |
commit | df124a756983c358185b00aab21873bef4fbe545 (patch) | |
tree | 98f14eeb8c798beb962d0afc0d6e9f9cf0b27da7 | |
parent | 6ea21852afbb5cc1521faf5f66ffc25191d92d2b (diff) | |
download | bcm5719-llvm-df124a756983c358185b00aab21873bef4fbe545.tar.gz bcm5719-llvm-df124a756983c358185b00aab21873bef4fbe545.zip |
[LV] Remove type restriction for vector phi creation
We previously only created a vector phi node for an induction variable if its
type matched the type of the canonical induction variable.
Differential Revision: https://reviews.llvm.org/D29776
llvm-svn: 294755
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 3 | ||||
-rw-r--r-- | llvm/test/Transforms/LoopVectorize/induction.ll | 16 |
2 files changed, 13 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 02a6f3f3eff..59e7f38cdb8 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -2421,8 +2421,7 @@ void InnerLoopVectorizer::widenIntInduction(PHINode *IV, TruncInst *Trunc) { // Try to create a new independent vector induction variable. If we can't // create the phi node, we will splat the scalar induction variable in each // loop iteration. - if (VF > 1 && IV->getType() == Induction->getType() && Step && - !shouldScalarizeInstruction(EntryVal)) { + if (VF > 1 && Step && !shouldScalarizeInstruction(EntryVal)) { createVectorIntInductionPHI(ID, EntryVal); VectorizedIV = true; } diff --git a/llvm/test/Transforms/LoopVectorize/induction.ll b/llvm/test/Transforms/LoopVectorize/induction.ll index 6213b4a7c2e..85f00b4dfc8 100644 --- a/llvm/test/Transforms/LoopVectorize/induction.ll +++ b/llvm/test/Transforms/LoopVectorize/induction.ll @@ -7,11 +7,19 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" ; Make sure that we can handle multiple integer induction variables. +; ; CHECK-LABEL: @multi_int_induction( -; CHECK: vector.body: -; CHECK: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] -; CHECK: %[[VAR:.*]] = trunc i64 %index to i32 -; CHECK: %offset.idx = add i32 190, %[[VAR]] +; CHECK: vector.body: +; CHECK-NEXT: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] +; CHECK-NEXT: %vec.ind = phi <2 x i32> [ <i32 190, i32 191>, %vector.ph ], [ %vec.ind.next, %vector.body ] +; CHECK: [[TMP3:%.*]] = add i64 %index, 0 +; CHECK-NEXT: [[TMP4:%.*]] = getelementptr inbounds i32, i32* %A, i64 [[TMP3]] +; CHECK-NEXT: [[TMP5:%.*]] = getelementptr i32, i32* [[TMP4]], i32 0 +; CHECK-NEXT: [[TMP6:%.*]] = bitcast i32* [[TMP5]] to <2 x i32>* +; CHECK-NEXT: store <2 x i32> %vec.ind, <2 x i32>* [[TMP6]], align 4 +; CHECK: %index.next = add i64 %index, 2 +; CHECK-NEXT: %vec.ind.next = add <2 x i32> %vec.ind, <i32 2, i32 2> +; CHECK: br i1 {{.*}}, label %middle.block, label %vector.body define void @multi_int_induction(i32* %A, i32 %N) { for.body.lr.ph: br label %for.body |