From: Bill Wendling Date: Wed, 5 Nov 2008 00:54:27 +0000 (+0000) Subject: Simplify the allocated size calculation. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fa75dc647cbe09c43169658106713a57409d0faf;p=oota-llvm.git Simplify the allocated size calculation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58740 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/StackProtector.cpp b/lib/CodeGen/StackProtector.cpp index 36ae2846a81..631760ad822 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(II)) { if (ConstantInt *CI = dyn_cast(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;