Encode the total stack if there isn't a frame.

llvm-svn: 145969
diff --git a/llvm/lib/Target/X86/X86FrameLowering.cpp b/llvm/lib/Target/X86/X86FrameLowering.cpp
index 5bf8132..6e2b3df 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.cpp
+++ b/llvm/lib/Target/X86/X86FrameLowering.cpp
@@ -564,12 +564,13 @@
     CompactUnwindEncoding |= (StackAdjust & 0xFF) << 16;
     CompactUnwindEncoding |= RegEnc & 0x7FFF;
   } else {
-    if ((StackSize & 0xFF) == StackSize) {
+    uint32_t TotalStackSize = StackAdjust + StackSize;
+    if ((TotalStackSize & 0xFF) == TotalStackSize) {
       // Frameless stack with a small stack size.
       CompactUnwindEncoding |= 0x02000000;
 
       // Encode the stack size.
-      CompactUnwindEncoding |= (StackSize & 0xFF) << 16;
+      CompactUnwindEncoding |= (TotalStackSize & 0xFF) << 16;
     } else {
       if ((StackAdjust & 0x7) != StackAdjust)
         // The extra stack adjustments are too big for us to handle.