diff options
author | Ayal Zaks <ayal.zaks@intel.com> | 2017-08-27 12:55:46 +0000 |
---|---|---|
committer | Ayal Zaks <ayal.zaks@intel.com> | 2017-08-27 12:55:46 +0000 |
commit | 1f58dda4e4d1c0ca420482f2a975908160dadd57 (patch) | |
tree | 3f56ad8236bd356a893f34875a1a030969985900 /llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll | |
parent | 8cb2e3245c6890a3d628c5841a7ae1f25b633f25 (diff) | |
download | bcm5719-llvm-1f58dda4e4d1c0ca420482f2a975908160dadd57.tar.gz bcm5719-llvm-1f58dda4e4d1c0ca420482f2a975908160dadd57.zip |
[LV] Fix PR34248 - recommit D32871 after revert r311304
Original commit r311077 of D32871 was reverted in r311304 due to failures
reported in PR34248.
This recommit fixes PR34248 by restricting the packing of predicated scalars
into vectors only when vectorizing, avoiding doing so when unrolling w/o
vectorizing. Added a test derived from the reproducer of PR34248.
llvm-svn: 311849
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll')
-rw-r--r-- | llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll b/llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll index 9765fdea9f0..fa821eadb09 100644 --- a/llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll +++ b/llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll @@ -1,4 +1,5 @@ ; RUN: opt -S -force-vector-width=2 -force-vector-interleave=1 -loop-vectorize -verify-loop-info -simplifycfg < %s | FileCheck %s +; RUN: opt -S -force-vector-width=1 -force-vector-interleave=2 -loop-vectorize -verify-loop-info < %s | FileCheck %s --check-prefix=UNROLL-NO-VF target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" @@ -209,9 +210,9 @@ entry: ; CHECK: br i1 {{.*}}, label %[[IF0:.+]], label %[[CONT0:.+]] ; CHECK: [[IF0]]: ; CHECK: %[[T00:.+]] = extractelement <2 x i32> %wide.load, i32 0 -; CHECK: %[[T01:.+]] = extractelement <2 x i32> %wide.load, i32 0 -; CHECK: %[[T02:.+]] = add nsw i32 %[[T01]], %x -; CHECK: %[[T03:.+]] = udiv i32 %[[T00]], %[[T02]] +; CHECK: %[[T01:.+]] = add nsw i32 %[[T00]], %x +; CHECK: %[[T02:.+]] = extractelement <2 x i32> %wide.load, i32 0 +; CHECK: %[[T03:.+]] = udiv i32 %[[T02]], %[[T01]] ; CHECK: %[[T04:.+]] = insertelement <2 x i32> undef, i32 %[[T03]], i32 0 ; CHECK: br label %[[CONT0]] ; CHECK: [[CONT0]]: @@ -219,15 +220,38 @@ entry: ; CHECK: br i1 {{.*}}, label %[[IF1:.+]], label %[[CONT1:.+]] ; CHECK: [[IF1]]: ; CHECK: %[[T06:.+]] = extractelement <2 x i32> %wide.load, i32 1 -; CHECK: %[[T07:.+]] = extractelement <2 x i32> %wide.load, i32 1 -; CHECK: %[[T08:.+]] = add nsw i32 %[[T07]], %x -; CHECK: %[[T09:.+]] = udiv i32 %[[T06]], %[[T08]] +; CHECK: %[[T07:.+]] = add nsw i32 %[[T06]], %x +; CHECK: %[[T08:.+]] = extractelement <2 x i32> %wide.load, i32 1 +; CHECK: %[[T09:.+]] = udiv i32 %[[T08]], %[[T07]] ; CHECK: %[[T10:.+]] = insertelement <2 x i32> %[[T05]], i32 %[[T09]], i32 1 ; CHECK: br label %[[CONT1]] ; CHECK: [[CONT1]]: ; CHECK: phi <2 x i32> [ %[[T05]], %[[CONT0]] ], [ %[[T10]], %[[IF1]] ] ; CHECK: br i1 {{.*}}, label %middle.block, label %vector.body +; Test predicating an instruction that feeds a vectorizable use, when unrolled +; but not vectorized. Derived from pr34248 reproducer. +; +; UNROLL-NO-VF-LABEL: predicated_udiv_scalarized_operand +; UNROLL-NO-VF: vector.body: +; UNROLL-NO-VF: %[[LOAD0:.+]] = load i32, i32* +; UNROLL-NO-VF: %[[LOAD1:.+]] = load i32, i32* +; UNROLL-NO-VF: br i1 {{.*}}, label %[[IF0:.+]], label %[[CONT0:.+]] +; UNROLL-NO-VF: [[IF0]]: +; UNROLL-NO-VF: %[[ADD0:.+]] = add nsw i32 %[[LOAD0]], %x +; UNROLL-NO-VF: %[[DIV0:.+]] = udiv i32 %[[LOAD0]], %[[ADD0]] +; UNROLL-NO-VF: br label %[[CONT0]] +; UNROLL-NO-VF: [[CONT0]]: +; UNROLL-NO-VF: phi i32 [ undef, %vector.body ], [ %[[DIV0]], %[[IF0]] ] +; UNROLL-NO-VF: br i1 {{.*}}, label %[[IF1:.+]], label %[[CONT1:.+]] +; UNROLL-NO-VF: [[IF1]]: +; UNROLL-NO-VF: %[[ADD1:.+]] = add nsw i32 %[[LOAD1]], %x +; UNROLL-NO-VF: %[[DIV1:.+]] = udiv i32 %[[LOAD1]], %[[ADD1]] +; UNROLL-NO-VF: br label %[[CONT1]] +; UNROLL-NO-VF: [[CONT1]]: +; UNROLL-NO-VF: phi i32 [ undef, %[[CONT0]] ], [ %[[DIV1]], %[[IF1]] ] +; UNROLL-NO-VF: br i1 {{.*}}, label %middle.block, label %vector.body +; for.body: %i = phi i64 [ 0, %entry ], [ %i.next, %for.inc ] %r = phi i32 [ 0, %entry ], [ %tmp6, %for.inc ] |