summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2013-07-25 02:55:14 +0000
committerNick Lewycky <nicholas@mxc.ca>2013-07-25 02:55:14 +0000
commitb97b1627316ef4a9eb7591ef4f814917ba054ff6 (patch)
tree6cec003f84bb5da6f0978b552fb4d48ce0d35c4a /test/Transforms
parent2d680824e3a5272e386aa6c1d2a66676de7899fd (diff)
downloadllvm-b97b1627316ef4a9eb7591ef4f814917ba054ff6.tar.gz
llvm-b97b1627316ef4a9eb7591ef4f814917ba054ff6.tar.bz2
llvm-b97b1627316ef4a9eb7591ef4f814917ba054ff6.tar.xz
Check that TD isn't NULL before dereferencing it down this path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/GlobalOpt/invariant-nodatalayout.ll17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Transforms/GlobalOpt/invariant-nodatalayout.ll b/test/Transforms/GlobalOpt/invariant-nodatalayout.ll
new file mode 100644
index 0000000000..a2abd52c4e
--- /dev/null
+++ b/test/Transforms/GlobalOpt/invariant-nodatalayout.ll
@@ -0,0 +1,17 @@
+; RUN: opt -globalopt -S -o - < %s | FileCheck %s
+; The check here is that it doesn't crash.
+
+declare {}* @llvm.invariant.start(i64 %size, i8* nocapture %ptr)
+
+@object1 = global { i32, i32 } zeroinitializer
+; CHECK: @object1 = global { i32, i32 } zeroinitializer
+
+define void @ctor1() {
+ %ptr = bitcast {i32, i32}* @object1 to i8*
+ call {}* @llvm.invariant.start(i64 4, i8* %ptr)
+ ret void
+}
+
+@llvm.global_ctors = appending constant
+ [1 x { i32, void ()* }]
+ [ { i32, void ()* } { i32 65535, void ()* @ctor1 } ]