summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMSubtarget.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2019-05-15 12:58:02 +0000
committerDavid Green <david.green@arm.com>2019-05-15 12:58:02 +0000
commit0582b22f10205c61d10531e4a6fa66c5048dc15c (patch)
tree30c258c265b875e2dbc84bc9b56113156f6326b1 /llvm/lib/Target/ARM/ARMSubtarget.cpp
parentd2d0f46cd2ae0684afa58d73e5effc1a197481d4 (diff)
downloadbcm5719-llvm-0582b22f10205c61d10531e4a6fa66c5048dc15c.tar.gz
bcm5719-llvm-0582b22f10205c61d10531e4a6fa66c5048dc15c.zip
[ARM] Don't use the Machine Scheduler for cortex-m at minsize
The new cortex-m schedule in rL360768 helps performance, but can increase the amount of high-registers used. This, on average, ends up increasing the codesize by a fair amount (because less instructions are converted from T2 to T1). On cortex-m at -Oz, where we are quite size-paranoid, it is better to use the existing DAG scheduler with the RegPressure scheduling preference (at least until the issues around T2 vs T1 instructions can be improved). I have also made sure that the Sched::RegPressure dag scheduler is always chosen for MinSize. The test shows one case where we increase the number of registers used. Differential Revision: https://reviews.llvm.org/D61882 llvm-svn: 360769
Diffstat (limited to 'llvm/lib/Target/ARM/ARMSubtarget.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMSubtarget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMSubtarget.cpp b/llvm/lib/Target/ARM/ARMSubtarget.cpp
index 22652d6256b..63f694199f4 100644
--- a/llvm/lib/Target/ARM/ARMSubtarget.cpp
+++ b/llvm/lib/Target/ARM/ARMSubtarget.cpp
@@ -361,6 +361,13 @@ unsigned ARMSubtarget::getMispredictionPenalty() const {
}
bool ARMSubtarget::enableMachineScheduler() const {
+ // The MachineScheduler can increase register usage, so we use more high
+ // registers and end up with more T2 instructions that cannot be converted to
+ // T1 instructions. At least until we do better at converting to thumb1
+ // instructions, on cortex-m at Oz where we are size-paranoid, don't use the
+ // Machine scheduler, relying on the DAG register pressure scheduler instead.
+ if (isMClass() && hasMinSize())
+ return false;
// Enable the MachineScheduler before register allocation for subtargets
// with the use-misched feature.
return useMachineScheduler();
OpenPOWER on IntegriCloud