diff options
author | Matthew Simpson <mssimpso@codeaurora.org> | 2016-07-06 14:26:59 +0000 |
---|---|---|
committer | Matthew Simpson <mssimpso@codeaurora.org> | 2016-07-06 14:26:59 +0000 |
commit | 433cb1dfe31a85e5e39743032a18c96bf12ce955 (patch) | |
tree | fc9919257eaf7d0e5944e0c4057d99727de3c1dd /llvm/test/Transforms/LoopVectorize/gep_with_bitcast.ll | |
parent | ad0a56f3da287000ba0b64642db99b17186c3a5b (diff) | |
download | bcm5719-llvm-433cb1dfe31a85e5e39743032a18c96bf12ce955.tar.gz bcm5719-llvm-433cb1dfe31a85e5e39743032a18c96bf12ce955.zip |
[LV] Don't widen trivial induction variables
We currently always vectorize induction variables. However, if an induction
variable is only used for counting loop iterations or computing addresses with
getelementptr instructions, we don't need to do this. Vectorizing these trivial
induction variables can create vector code that is difficult to simplify later
on. This is especially true when the unroll factor is greater than one, and we
create vector arithmetic when computing step vectors. With this patch, we check
if an induction variable is only used for counting iterations or computing
addresses, and if so, scalarize the arithmetic when computing step vectors
instead. This allows for greater simplification.
This patch addresses the suboptimal pointer arithmetic sequence seen in
PR27881.
Reference: https://llvm.org/bugs/show_bug.cgi?id=27881
Differential Revision: http://reviews.llvm.org/D21620
llvm-svn: 274627
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize/gep_with_bitcast.ll')
-rw-r--r-- | llvm/test/Transforms/LoopVectorize/gep_with_bitcast.ll | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/gep_with_bitcast.ll b/llvm/test/Transforms/LoopVectorize/gep_with_bitcast.ll index fb12e172f54..e73b6eacbe1 100644 --- a/llvm/test/Transforms/LoopVectorize/gep_with_bitcast.ll +++ b/llvm/test/Transforms/LoopVectorize/gep_with_bitcast.ll @@ -12,11 +12,11 @@ target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" ; CHECK-LABEL: @foo ; CHECK: vector.body -; CHECK: %0 = phi -; CHECK: %2 = getelementptr inbounds double*, double** %in, i64 %0 -; CHECK: %3 = bitcast double** %2 to <4 x i64>* -; CHECK: %wide.load = load <4 x i64>, <4 x i64>* %3, align 8 -; CHECK: %4 = icmp eq <4 x i64> %wide.load, zeroinitializer +; CHECK: %[[IV:.+]] = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] +; CHECK: %[[v0:.+]] = getelementptr inbounds double*, double** %in, i64 %[[IV]] +; CHECK: %[[v1:.+]] = bitcast double** %[[v0]] to <4 x i64>* +; CHECK: %wide.load = load <4 x i64>, <4 x i64>* %[[v1]], align 8 +; CHECK: icmp eq <4 x i64> %wide.load, zeroinitializer ; CHECK: br i1 define void @foo(double** noalias nocapture readonly %in, double** noalias nocapture readnone %out, i8* noalias nocapture %res) #0 { |