mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
cabb944249
Use ScalarEvolution to calculate memory access bounds. Handle function calls based on readnone/nocapture attributes. Handle memory intrinsics with constant size. This change improves both recall and precision of IsAllocaSafe. See the new tests (ex. BitCastWide) for the kind of code that was wrongly classified as safe. SCEV efficiency seems to be limited by the fact the SafeStack runs late (in CodeGenPrepare), and many loops are unrolled or otherwise not in LCSSA. llvm-svn: 253083
18 lines
518 B
LLVM
18 lines
518 B
LLVM
; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
|
|
; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
|
|
|
|
@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
|
|
|
|
; Returns an alloca address.
|
|
; Requires protector.
|
|
|
|
define i64 @foo() nounwind readnone safestack {
|
|
entry:
|
|
; CHECK-LABEL: define i64 @foo(
|
|
; CHECK: __safestack_unsafe_stack_ptr
|
|
; CHECK: ret i64
|
|
%x = alloca [100 x i32], align 16
|
|
%0 = ptrtoint [100 x i32]* %x to i64
|
|
ret i64 %0
|
|
}
|