1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Simplify the allocated size calculation.

llvm-svn: 58740
This commit is contained in:
Bill Wendling 2008-11-05 00:54:27 +00:00
parent 2461aaa183
commit 8c86d20576

View File

@ -201,9 +201,9 @@ bool StackProtector::RequiresStackProtector() const {
II = BB->begin(), IE = BB->end(); II != IE; ++II)
if (AllocaInst *AI = dyn_cast<AllocaInst>(II)) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(AI->getArraySize())) {
uint64_t Bytes = TD->getTypeSizeInBits(AI->getAllocatedType()) / 8;
const APInt &Size = CI->getValue();
StackSize += Bytes * Size.getZExtValue();
const Type *Ty = AI->getAllocatedType();
uint64_t TySize = TD->getABITypeSize(Ty);
StackSize += TySize * CI->getZExtValue(); // Total allocated size.
if (SSPBufferSize <= StackSize)
return true;