summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-06-27 08:38:17 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-06-27 08:38:17 +0000
commit9f3979fd782dc823cc0cdf38c69a14812e5254a8 (patch)
treeaef23faf69c6eeeaaa2b04b94bc8217ef6b82860 /llvm/test/Transforms
parent5185c3c271418eeac9ce8588210c9e103cdd08d4 (diff)
downloadbcm5719-llvm-9f3979fd782dc823cc0cdf38c69a14812e5254a8.tar.gz
bcm5719-llvm-9f3979fd782dc823cc0cdf38c69a14812e5254a8.zip
[LoopVectorize] Pointer indicies may be wider than the pointer
If we are dealing with a pointer induction variable, isInductionPHI gives back a step value of Stride / size of pointer. However, we might be indexing with a legal type wider than the pointer width. Handle this by inserting casts where appropriate instead of crashing. This fixes PR23954. llvm-svn: 240877
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/LoopVectorize/X86/ptr-indvar-crash.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/X86/ptr-indvar-crash.ll b/llvm/test/Transforms/LoopVectorize/X86/ptr-indvar-crash.ll
new file mode 100644
index 00000000000..56ea2f4c31d
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/X86/ptr-indvar-crash.ll
@@ -0,0 +1,20 @@
+; RUN: opt -slp-vectorizer -S %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @f(i128 %p1) {
+entry:
+ br label %while.body
+
+while.body:
+ %p.05 = phi i8* [ %add.ptr, %while.body ], [ null, %entry ]
+ %p1.addr.04 = phi i128 [ %sub, %while.body ], [ %p1, %entry ]
+ %add.ptr = getelementptr inbounds i8, i8* %p.05, i32 2
+ %sub = add nsw i128 %p1.addr.04, -2
+ %tobool = icmp eq i128 %sub, 0
+ br i1 %tobool, label %while.end, label %while.body
+
+while.end:
+ ret void
+}
OpenPOWER on IntegriCloud