aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;