mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-18 19:28:16 +00:00
Simplify the allocated size calculation.
llvm-svn: 58740
This commit is contained in:
parent
2461aaa183
commit
8c86d20576
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user