mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
5200dee212
Add a pass to lower is.constant and objectsize intrinsics This pass lowers is.constant and objectsize intrinsics not simplified by earlier constant folding, i.e. if the object given is not constant or if not using the optimized pass chain. The result is recursively simplified and constant conditionals are pruned, so that dead blocks are removed even for -O0. This allows inline asm blocks with operand constraints to work all the time. The new pass replaces the existing lowering in the codegen-prepare pass and fallbacks in SDAG/GlobalISEL and FastISel. The latter now assert on the intrinsics. Differential Revision: https://reviews.llvm.org/D65280 llvm-svn: 374784
17 lines
501 B
LLVM
17 lines
501 B
LLVM
; RUN: opt -S -lower-constant-intrinsics %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)
|