forked from OSchip/llvm-project
CodeGen: avoid emitting unnecessary CFI
Remove unnecessary clutter in assembly output. When using SjLj EH, the CFI is not actually used for anything. Do not emit the CFI needlessly. The minor test adjustments are interesting. The prologue test was just overzealous matcching. The interesting case is the LSDA change. It was originally added to ensure that various compilations did not mangle the name (it explicitly checked the name!). However, subsequent cleanups made it more reliant on the CFI to find the name. Parse the generated code flow to generically find the label still. llvm-svn: 275614
This commit is contained in:
parent
a78937afb2
commit
467269a40e
|
@ -66,13 +66,13 @@ DwarfCFIException::~DwarfCFIException() {}
|
||||||
/// endModule - Emit all exception information that should come after the
|
/// endModule - Emit all exception information that should come after the
|
||||||
/// content.
|
/// content.
|
||||||
void DwarfCFIException::endModule() {
|
void DwarfCFIException::endModule() {
|
||||||
if (moveTypeModule == AsmPrinter::CFI_M_Debug)
|
|
||||||
Asm->OutStreamer->EmitCFISections(false, true);
|
|
||||||
|
|
||||||
// SjLj uses this pass and it doesn't need this info.
|
// SjLj uses this pass and it doesn't need this info.
|
||||||
if (!Asm->MAI->usesCFIForEH())
|
if (!Asm->MAI->usesCFIForEH())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (moveTypeModule == AsmPrinter::CFI_M_Debug)
|
||||||
|
Asm->OutStreamer->EmitCFISections(false, true);
|
||||||
|
|
||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
|
|
||||||
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
||||||
|
@ -133,7 +133,8 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) {
|
||||||
shouldEmitLSDA = shouldEmitPersonality &&
|
shouldEmitLSDA = shouldEmitPersonality &&
|
||||||
LSDAEncoding != dwarf::DW_EH_PE_omit;
|
LSDAEncoding != dwarf::DW_EH_PE_omit;
|
||||||
|
|
||||||
shouldEmitCFI = shouldEmitPersonality || shouldEmitMoves;
|
shouldEmitCFI = MF->getMMI().getContext().getAsmInfo()->usesCFIForEH() &&
|
||||||
|
(shouldEmitPersonality || shouldEmitMoves);
|
||||||
beginFragment(&*MF->begin(), getExceptionSym);
|
beginFragment(&*MF->begin(), getExceptionSym);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
; RUN: llc < %s -mtriple=arm-apple-darwin9 -march=arm | FileCheck %s
|
; RUN: llc < %s -mtriple=arm-apple-darwin9 -march=arm | FileCheck %s
|
||||||
|
|
||||||
; CHECK: .cfi_lsda 16, [[LABEL:.*]]
|
; CHECK: ldr r0, [[CPI_PERSONALITY:[A-Za-z0-9_]+]]
|
||||||
; CHECK: .long [[LABEL]]-
|
; CHECK: ldr r0, [[CPI_LSDA:[A-Za-z0-9_]+]]
|
||||||
; CHECK: [[LABEL]]:
|
; CHECK: [[CPI_LSDA]]:
|
||||||
|
; CHECK: .long [[LSDA_LABEL:[A-Za-z0-9_]+]]-
|
||||||
|
; CHECK: [[LSDA_LABEL]]:
|
||||||
; CHECK: .byte 255 @ @LPStart Encoding = omit
|
; CHECK: .byte 255 @ @LPStart Encoding = omit
|
||||||
|
|
||||||
%struct.A = type { i32* }
|
%struct.A = type { i32* }
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
define void @prologue_end_test() nounwind uwtable !dbg !4 {
|
define void @prologue_end_test() nounwind uwtable !dbg !4 {
|
||||||
; CHECK: prologue_end_test:
|
; CHECK: prologue_end_test:
|
||||||
; CHECK: .cfi_startproc
|
|
||||||
; CHECK: push {r7, lr}
|
; CHECK: push {r7, lr}
|
||||||
; CHECK: {{mov r7, sp|add r7, sp}}
|
; CHECK: {{mov r7, sp|add r7, sp}}
|
||||||
; CHECK: sub sp
|
; CHECK: sub sp
|
||||||
|
|
Loading…
Reference in New Issue