summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-06-18 05:47:49 +0000
committerCameron Zwarich <zwarich@apple.com>2011-06-18 05:47:49 +0000
commit2a26100c87351e0b89c469da9b0dff12f3383f1c (patch)
tree125a70352a4e17074382497d8d7e3103b0a50ad8 /llvm/test
parentcd42038fdc1e0a18fc40e4b5c3ee7f52df0f3d7b (diff)
downloadbcm5719-llvm-2a26100c87351e0b89c469da9b0dff12f3383f1c.tar.gz
bcm5719-llvm-2a26100c87351e0b89c469da9b0dff12f3383f1c.zip
Fix an invalid bitcast crash that occurs when doing a partial memset of a vector
alloca. Fixes part of <rdar://problem/9580800>. llvm-svn: 133336
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/ScalarRepl/2011-06-17-VectorPartialMemset.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ScalarRepl/2011-06-17-VectorPartialMemset.ll b/llvm/test/Transforms/ScalarRepl/2011-06-17-VectorPartialMemset.ll
new file mode 100644
index 00000000000..29d195eba36
--- /dev/null
+++ b/llvm/test/Transforms/ScalarRepl/2011-06-17-VectorPartialMemset.ll
@@ -0,0 +1,22 @@
+; RUN: opt < %s -scalarrepl -S | FileCheck %s
+target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
+target triple = "thumbv7-apple-darwin10"
+
+; CHECK: f
+; CHECK-NOT: alloca
+; CHECK: %[[A:[a-z0-9]*]] = and i128 undef, -16777216
+; CHECK: %[[B:[a-z0-9]*]] = bitcast i128 %[[A]] to <4 x float>
+; CHECK: %[[C:[a-z0-9]*]] = extractelement <4 x float> %[[B]], i32 0
+; CHECK: ret float %[[C]]
+
+define float @f() nounwind ssp {
+entry:
+ %a = alloca <4 x float>, align 16
+ %p = bitcast <4 x float>* %a to i8*
+ call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 3, i32 16, i1 false)
+ %vec = load <4 x float>* %a, align 8
+ %val = extractelement <4 x float> %vec, i32 0
+ ret float %val
+}
+
+declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
OpenPOWER on IntegriCloud