[safestack] Rewrite isAllocaSafe using SCEV.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 13 Nov 2015 21:21:42 +0000 (21:21 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Fri, 13 Nov 2015 21:21:42 +0000 (21:21 +0000)
commite528e5711e69a2dbb237da7afc66a881f00d53bb
treeb2be82a3a12915744b9f2d05b1c4942af16fadd7
parent6dc74bec886b8364e386f8d7cb12a5e4a7a6516c
[safestack] Rewrite isAllocaSafe using SCEV.

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253083 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Instrumentation/SafeStack.cpp
test/Transforms/SafeStack/call.ll
test/Transforms/SafeStack/cast.ll
test/Transforms/SafeStack/ret.ll [new file with mode: 0644]
test/Transforms/SafeStack/store.ll [new file with mode: 0644]