mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-21 12:02:58 +02:00
[X86] MOVPC32r should only emit CFI adjustments when needed
We only want to emit CFI adjustments when actually using DWARF. This fixes PR25828. Differential Revision: http://reviews.llvm.org/D15522 llvm-svn: 255664
This commit is contained in:
parent
5c7e1e0f63
commit
7915950634
@ -1145,11 +1145,12 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
bool hasFP = FrameLowering->hasFP(*MF);
|
||||
|
||||
// TODO: This is needed only if we require precise CFA.
|
||||
bool NeedsDwarfCFI =
|
||||
(MMI->hasDebugInfo() || MF->getFunction()->needsUnwindTableEntry());
|
||||
bool HasActiveDwarfFrame = OutStreamer->getNumFrameInfos() &&
|
||||
!OutStreamer->getDwarfFrameInfos().back().End;
|
||||
|
||||
int stackGrowth = -RI->getSlotSize();
|
||||
|
||||
if (NeedsDwarfCFI && !hasFP) {
|
||||
if (HasActiveDwarfFrame && !hasFP) {
|
||||
OutStreamer->EmitCFIAdjustCfaOffset(-stackGrowth);
|
||||
}
|
||||
|
||||
@ -1160,7 +1161,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
||||
EmitAndCountInstruction(MCInstBuilder(X86::POP32r)
|
||||
.addReg(MI->getOperand(0).getReg()));
|
||||
|
||||
if (NeedsDwarfCFI && !hasFP) {
|
||||
if (HasActiveDwarfFrame && !hasFP) {
|
||||
OutStreamer->EmitCFIAdjustCfaOffset(stackGrowth);
|
||||
}
|
||||
return;
|
||||
|
30
test/CodeGen/X86/pr25828.ll
Normal file
30
test/CodeGen/X86/pr25828.ll
Normal file
@ -0,0 +1,30 @@
|
||||
; RUN: llc < %s -mtriple=i686-pc-windows-msvc -relocation-model=pic | FileCheck %s
|
||||
; MOVPC32r should not generate CFI under windows
|
||||
|
||||
; CHECK-LABEL: _foo:
|
||||
; CHECK-NOT: .cfi_adjust_cfa_offset
|
||||
define void @foo(i8) {
|
||||
entry-block:
|
||||
switch i8 %0, label %bb2 [
|
||||
i8 1, label %bb1
|
||||
i8 2, label %bb2
|
||||
i8 3, label %bb3
|
||||
i8 4, label %bb4
|
||||
i8 5, label %bb5
|
||||
]
|
||||
|
||||
bb1:
|
||||
ret void
|
||||
|
||||
bb2:
|
||||
ret void
|
||||
|
||||
bb3:
|
||||
ret void
|
||||
|
||||
bb4:
|
||||
ret void
|
||||
|
||||
bb5:
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user