[llvm] r307811 - Add a test for r307754

George Burgess IV via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 09:30:37 PDT 2017


Author: gbiv
Date: Wed Jul 12 09:30:37 2017
New Revision: 307811

URL: http://llvm.org/viewvc/llvm-project?rev=307811&view=rev
Log:
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).

Added:
    llvm/trunk/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll

Added: llvm/trunk/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll?rev=307811&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll (added)
+++ llvm/trunk/test/Transforms/CodeGenPrepare/crash-on-large-allocas.ll Wed Jul 12 09:30:37 2017
@@ -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)




More information about the llvm-commits mailing list