aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-02-29 07:12:06 +0000
committerChris Lattner <sabre@nondot.org>2008-02-29 07:12:06 +0000
commit5f062546748e9356b6b3dd8e653d6a6758d5253a (patch)
tree5b2bbf20329de2c6103c0a7114e72aebcba8eda8 /test
parent41d58650042669eb6487443d1ace8e9fce07d5b3 (diff)
downloadexternal_llvm-5f062546748e9356b6b3dd8e653d6a6758d5253a.zip
external_llvm-5f062546748e9356b6b3dd8e653d6a6758d5253a.tar.gz
external_llvm-5f062546748e9356b6b3dd8e653d6a6758d5253a.tar.bz2
fix a bug Anders ran into where scalarrepl would crash when promoting
a union containing a vector and an array whose elements were smaller than the vector elements. this means we need to compile the load of the array elements into an extract element plus a truncate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll b/test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll
new file mode 100644
index 0000000..9ec5fa3
--- /dev/null
+++ b/test/Transforms/ScalarRepl/2008-02-28-SubElementExtractCrash.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
+target triple = "i686-apple-darwin8"
+ %struct..0anon = type { <1 x i64> }
+
+define i32 @main(i32 %argc, i8** %argv) {
+entry:
+ %c = alloca %struct..0anon ; <%struct..0anon*> [#uses=2]
+ %tmp2 = getelementptr %struct..0anon* %c, i32 0, i32 0 ; <<1 x i64>*> [#uses=1]
+ store <1 x i64> zeroinitializer, <1 x i64>* %tmp2, align 8
+ %tmp7 = getelementptr %struct..0anon* %c, i32 0, i32 0 ; <<1 x i64>*> [#uses=1]
+ %tmp78 = bitcast <1 x i64>* %tmp7 to [2 x i32]* ; <[2 x i32]*> [#uses=1]
+ %tmp9 = getelementptr [2 x i32]* %tmp78, i32 0, i32 0 ; <i32*> [#uses=1]
+ %tmp10 = load i32* %tmp9, align 4 ; <i32> [#uses=0]
+ unreachable
+}