This is meant to be used with clang's __builtin_dynamic_object_size. When 'true' is passed to this parameter, the intrinsic has the potential to be folded into instructions that will be evaluated at run time. When 'false', the objectsize intrinsic behaviour is unchanged. rdar://32212419 Differential revision: https://reviews.llvm.org/D56761 llvm-svn: 352664
17 lines
490 B
LLVM
17 lines
490 B
LLVM
; 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, i1 false)
|
|
; CHECK: ret i16 -1
|
|
ret i16 %j
|
|
}
|
|
|
|
declare i16 @llvm.objectsize.i16.p0i8(i8*, i1, i1, i1)
|