summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2017-07-12 16:30:37 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2017-07-12 16:30:37 +0000
commit6f92d2dd24b03e26496bf59fea108ee16c18d28f (patch)
tree33562b46982bb754c11deef7c051c369865cd3ff /llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll
parent98a6b3ea87152728f2e4e513fe05d629b722e4e0 (diff)
downloadbcm5719-llvm-6f92d2dd24b03e26496bf59fea108ee16c18d28f.tar.gz
bcm5719-llvm-6f92d2dd24b03e26496bf59fea108ee16c18d28f.zip
Add a test for r307754
As promised in D35003. Uses -codegenprepare instead of -instcombine since we hit the same buggy path anyway, and CGP lets us keep this test really simple (instcombine likes turning the alloca T, N into alloca [N x T], which hides the bug this is testing for). llvm-svn: 307811
Diffstat (limited to 'llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll')
-rw-r--r--llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll b/llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll
new file mode 100644
index 00000000000..3808c0e61c1
--- /dev/null
+++ b/llvm/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll
@@ -0,0 +1,16 @@
+; RUN: opt -S -codegenprepare %s -o - | FileCheck %s
+;
+; Ensure that we don't {crash,return a bad value} when given an alloca larger
+; than what a pointer can represent.
+
+target datalayout = "p:16:16"
+
+; CHECK-LABEL: @alloca_overflow_is_unknown(
+define i16 @alloca_overflow_is_unknown() {
+ %i = alloca i8, i32 65537
+ %j = call i16 @llvm.objectsize.i16.p0i8(i8* %i, i1 false, i1 false)
+ ; CHECK: ret i16 -1
+ ret i16 %j
+}
+
+declare i16 @llvm.objectsize.i16.p0i8(i8*, i1, i1)
OpenPOWER on IntegriCloud