diff options
| author | Bill Wendling <isanbard@gmail.com> | 2008-11-05 00:54:27 +0000 | 
|---|---|---|
| committer | Bill Wendling <isanbard@gmail.com> | 2008-11-05 00:54:27 +0000 | 
| commit | f1b4e2626bf1dfbbb9463a50afe115e65269d2e9 (patch) | |
| tree | 2006197ede2368147fc6ab95de4553fe3eecca93 | |
| parent | 75e38fedc8b48a2f65cf265ba2b854e7ac899950 (diff) | |
| download | bcm5719-llvm-f1b4e2626bf1dfbbb9463a50afe115e65269d2e9.tar.gz bcm5719-llvm-f1b4e2626bf1dfbbb9463a50afe115e65269d2e9.zip  | |
Simplify the allocated size calculation.
llvm-svn: 58740
| -rw-r--r-- | llvm/lib/CodeGen/StackProtector.cpp | 6 | 
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/StackProtector.cpp b/llvm/lib/CodeGen/StackProtector.cpp index 36ae2846a81..631760ad822 100644 --- a/llvm/lib/CodeGen/StackProtector.cpp +++ b/llvm/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;  | 

