forked from OSchip/llvm-project
[ARM] Enable outliner at -Oz for M-class
Enable default outlining when the function has the minsize attribute and we're targeting an m-class core. Differential Revision: https://reviews.llvm.org/D82951
This commit is contained in:
parent
04879086b4
commit
03141aa04a
|
@ -6129,3 +6129,8 @@ MachineBasicBlock::iterator ARMBaseInstrInfo::insertOutlinedCall(
|
|||
It--;
|
||||
return CallPt;
|
||||
}
|
||||
|
||||
bool ARMBaseInstrInfo::shouldOutlineFromFunctionByDefault(
|
||||
MachineFunction &MF) const {
|
||||
return Subtarget.isMClass() && MF.getFunction().hasMinSize();
|
||||
}
|
||||
|
|
|
@ -372,6 +372,9 @@ public:
|
|||
MachineBasicBlock::iterator &It, MachineFunction &MF,
|
||||
const outliner::Candidate &C) const override;
|
||||
|
||||
/// Enable outlining by default at -Oz.
|
||||
bool shouldOutlineFromFunctionByDefault(MachineFunction &MF) const override;
|
||||
|
||||
private:
|
||||
/// Returns an unused general-purpose register which can be used for
|
||||
/// constructing an outlined call if one exists. Returns 0 otherwise.
|
||||
|
|
|
@ -251,7 +251,7 @@ ARMBaseTargetMachine::ARMBaseTargetMachine(const Target &T, const Triple &TT,
|
|||
|
||||
// ARM supports the MachineOutliner.
|
||||
setMachineOutliner(true);
|
||||
setSupportsDefaultOutlining(false);
|
||||
setSupportsDefaultOutlining(true);
|
||||
}
|
||||
|
||||
ARMBaseTargetMachine::~ARMBaseTargetMachine() = default;
|
||||
|
|
|
@ -170,6 +170,8 @@
|
|||
; CHECK-NEXT: Contiguously Lay Out Funclets
|
||||
; CHECK-NEXT: StackMap Liveness Analysis
|
||||
; CHECK-NEXT: Live DEBUG_VALUE analysis
|
||||
; CHECK-NEXT: Machine Outliner
|
||||
; CHECK-NEXT: FunctionPass Manager
|
||||
; CHECK-NEXT: MachineDominator Tree Construction
|
||||
; CHECK-NEXT: ARM constant island placement and branch shortening pass
|
||||
; CHECK-NEXT: MachineDominator Tree Construction
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
; RUN: | FileCheck %s --check-prefix=MACHO
|
||||
; RUN: llc -enable-machine-outliner -verify-machineinstrs -mtriple=thumbv5-- \
|
||||
; RUN: --stop-after=machine-outliner < %s | FileCheck %s --check-prefix=THUMB1
|
||||
; RUN: llc -verify-machineinstrs -mtriple=thumbv8m.main \
|
||||
; RUN: --stop-after=machine-outliner < %s | FileCheck %s --check-prefix=THUMB
|
||||
|
||||
; ARM-LABEL: name: OUTLINED_FUNCTION_0
|
||||
; ARM: $r0 = MOVi 1, 14 /* CC::al */, $noreg, $noreg
|
||||
|
@ -31,7 +33,7 @@
|
|||
|
||||
; THUMB1-NOT: OUTLINED_FUNCTION_0
|
||||
|
||||
define void @a() {
|
||||
define void @a() #0 {
|
||||
entry:
|
||||
tail call void @z(i32 1, i32 2, i32 3, i32 4)
|
||||
ret void
|
||||
|
@ -39,8 +41,10 @@ entry:
|
|||
|
||||
declare void @z(i32, i32, i32, i32)
|
||||
|
||||
define dso_local void @b(i32* nocapture readnone %p) {
|
||||
define dso_local void @b(i32* nocapture readnone %p) #0 {
|
||||
entry:
|
||||
tail call void @z(i32 1, i32 2, i32 3, i32 4)
|
||||
ret void
|
||||
}
|
||||
|
||||
attributes #0 = { minsize optsize }
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
; RUN: | FileCheck %s --check-prefix=MACHO
|
||||
; RUN: llc -enable-machine-outliner -verify-machineinstrs -mtriple=thumbv5-- \
|
||||
; RUN: --stop-after=machine-outliner < %s | FileCheck %s --check-prefix=THUMB1
|
||||
; RUN: llc -verify-machineinstrs -mtriple=thumbv8m.main \
|
||||
; RUN: --stop-after=machine-outliner < %s | FileCheck %s --check-prefix=THUMB
|
||||
|
||||
declare i32 @thunk_called_fn(i32, i32, i32, i32)
|
||||
|
||||
define i32 @a() {
|
||||
define i32 @a() #0 {
|
||||
; ARM-LABEL: name: a
|
||||
; ARM: bb.0.entry:
|
||||
; ARM-NEXT: liveins: $r11, $lr
|
||||
|
@ -52,7 +54,7 @@ entry:
|
|||
ret i32 %cx
|
||||
}
|
||||
|
||||
define i32 @b() {
|
||||
define i32 @b() #0 {
|
||||
; ARM-LABEL: name: b
|
||||
; ARM: bb.0.entry:
|
||||
; ARM-NEXT: liveins: $r11, $lr
|
||||
|
@ -117,3 +119,5 @@ entry:
|
|||
; MACHO-NEXT: $r2, dead $cpsr = tMOVi8 3, 14 /* CC::al */, $noreg
|
||||
; MACHO-NEXT: $r3, dead $cpsr = tMOVi8 4, 14 /* CC::al */, $noreg
|
||||
; MACHO-NEXT: tTAILJMPd @thunk_called_fn, 14 /* CC::al */, $noreg, implicit $sp
|
||||
|
||||
attributes #0 = { minsize optsize }
|
||||
|
|
Loading…
Reference in New Issue