diff options
author | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-09-16 16:17:24 +0000 |
---|---|---|
committer | Arnold Schwaighofer <aschwaighofer@apple.com> | 2013-09-16 16:17:24 +0000 |
commit | 5721d2f674008cd2cfa5696441e46daa035408b3 (patch) | |
tree | c5ed59dc8c0ca313b7ba63e01413473e484b96fe /test/Transforms/LoopVectorize | |
parent | e5c8c5a1bcecff7e2aa60672be6af2062ad63e6a (diff) | |
download | llvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.gz llvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.bz2 llvm-5721d2f674008cd2cfa5696441e46daa035408b3.tar.xz |
Don't vectorize if there are outside loop users of the induction variable.
We would have to compute the pre increment value, either by computing it on
every loop iteration or by splitting the edge out of the loop and inserting a
computation for it there.
For now, just give up vectorizing such loops.
Fixes PR17179.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopVectorize')
-rw-r--r-- | test/Transforms/LoopVectorize/no_outside_user.ll | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/Transforms/LoopVectorize/no_outside_user.ll b/test/Transforms/LoopVectorize/no_outside_user.ll index 6f0357c5e5..c83d7aac7b 100644 --- a/test/Transforms/LoopVectorize/no_outside_user.ll +++ b/test/Transforms/LoopVectorize/no_outside_user.ll @@ -12,6 +12,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 ; We used to vectorize this loop. But it has a value that is used outside of the ; and is not a recognized reduction variable "tmp17". +; CHECK-LABEL: main ; CHECK-NOT: <2 x i32> define i32 @main() { @@ -38,4 +39,33 @@ f1.exit.loopexit: ret i32 %.lcssa } +; Don't vectorize this loop. Its phi node (induction variable) has an outside +; loop user. We currently don't handle this case. +; PR17179 +; CHECK-LABEL: test2 +; CHECK-NOT: <2 x + +@x1 = common global i32 0, align 4 +@x2 = common global i32 0, align 4 +@x0 = common global i32 0, align 4 + +define i32 @test2() { +entry: + store i32 0, i32* @x1, align 4 + %0 = load i32* @x0, align 4 + br label %for.cond1.preheader + +for.cond1.preheader: + %inc7 = phi i32 [ 0, %entry ], [ %inc, %for.cond1.preheader ] + %inc = add nsw i32 %inc7, 1 + %cmp = icmp eq i32 %inc, 52 + br i1 %cmp, label %for.end5, label %for.cond1.preheader + +for.end5: + %inc7.lcssa = phi i32 [ %inc7, %for.cond1.preheader ] + %xor = xor i32 %inc7.lcssa, %0 + store i32 52, i32* @x1, align 4 + store i32 1, i32* @x2, align 4 + ret i32 %xor +} |