Index: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp =================================================================== --- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp +++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp @@ -635,16 +635,6 @@ CompactUnwindEncoding |= (StackAdjust & 0xFF) << 16; CompactUnwindEncoding |= RegEnc & CU::UNWIND_BP_FRAME_REGISTERS; } else { - // If the amount of the stack allocation is the size of a register, then - // we "push" the RAX/EAX register onto the stack instead of adjusting the - // stack pointer with a SUB instruction. We don't support the push of the - // RAX/EAX register with compact unwind. So we check for that situation - // here. - if ((NumDefCFAOffsets == SavedRegIdx + 1 && - StackSize - PrevStackSize == 1) || - (Instrs.size() == 1 && NumDefCFAOffsets == 1 && StackSize == 2)) - return CU::UNWIND_MODE_DWARF; - SubtractInstrIdx += InstrOffset; ++StackAdjust; Index: llvm/trunk/test/MC/X86/compact-unwind.s =================================================================== --- llvm/trunk/test/MC/X86/compact-unwind.s +++ llvm/trunk/test/MC/X86/compact-unwind.s @@ -64,6 +64,24 @@ retq .cfi_endproc +# Check that a adjustment through a push %rax is the same as a sub. + +# CHECK: Entry at offset 0x40: +# CHECK-NEXT: start: 0x2a _testrax +# CHECK-NEXT: length: 0x5 +# CHECK-NEXT: compact encoding: 0x02020000 + .globl _testrax +_testrax: ## @testrax + .cfi_startproc +## %bb.0: ## %entry + pushq %rax +Ltmp15: + .cfi_def_cfa_offset 16 + xorl %eax, %eax + popq %rax + retq + .cfi_endproc + .section __TEXT,__cstring,cstring_literals L_.str: ## @.str .asciz "%d\n"