summaryrefslogtreecommitdiff
path: root/lib/CodeGen/StackProtector.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2008-11-05 00:54:27 +0000
committerBill Wendling <isanbard@gmail.com>2008-11-05 00:54:27 +0000
commitfa75dc647cbe09c43169658106713a57409d0faf (patch)
tree5f4708e2e9c3975f37aa85e6e96aa0c6e1455fc6 /lib/CodeGen/StackProtector.cpp
parentf0eaa9a233e6162aab4b2a2b5bfc63d6f94b9384 (diff)
downloadllvm-fa75dc647cbe09c43169658106713a57409d0faf.tar.gz
llvm-fa75dc647cbe09c43169658106713a57409d0faf.tar.bz2
llvm-fa75dc647cbe09c43169658106713a57409d0faf.tar.xz
Simplify the allocated size calculation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58740 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/StackProtector.cpp')
-rw-r--r--lib/CodeGen/StackProtector.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp
index 36ae2846a8..631760ad82 100644
--- a/lib/CodeGen/StackProtector.cpp
+++ b/lib/CodeGen/StackProtector.cpp
@@ -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;