[PATCH] D69775: [Scheduling][ARM] Consistently enable PostRA Machine scheduling

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 3 13:06:34 PST 2019


dmgreen created this revision.
dmgreen added reviewers: t.p.northover, atrick, MatzeB, samparker.
Herald added subscribers: dexonsmith, javed.absar, hiraditya, kristof.beyls, mehdi_amini.
Herald added a project: LLVM.

In the ARM backend, for historical reasons we have only some targets using Machine Scheduling. The rest use the old list scheduler as they are using itinaries and the list scheduler seems to produce better code (and not crash running out of register on v6m codes). So whether to use the MIScheduler or not is checked at runtime from the subtarget features.

This is fine, except for post-ra scheduling. Whether to use the old post-ra list scheduler or the post-ra machine schedule is decided as the pass manager is set up, in arms case from a newly constructed subtarget. Under some situations, like LTO, this won't include the correct cpu so can pick the wrong option. This can have a surprising effect on performance.

To fix that, this patch overrides targetSchedulesPostRAScheduling and addPreSched2 in the ARM backend, adding _both_ post-ra schedulers and picking at runtime which to execute. To pick between the two I've had to add a enablePostRAMachineScheduler() method that normally returns enableMachineScheduler() && enablePostRAScheduler(), which can be overridden to enable just one of PostRAMachineScheduler vs PostRAScheduler.


https://reviews.llvm.org/D69775

Files:
  llvm/include/llvm/CodeGen/TargetSubtargetInfo.h
  llvm/lib/CodeGen/MachineScheduler.cpp
  llvm/lib/CodeGen/TargetSubtargetInfo.cpp
  llvm/lib/Target/ARM/ARMSubtarget.cpp
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.h
  llvm/test/CodeGen/ARM/O3-pipeline.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-ldm-wrback.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-ldm.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-stm-wrback.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-stm.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-vldm-wrback.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-vldm.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-vstm-wrback.ll
  llvm/test/CodeGen/ARM/cortex-a57-misched-vstm.ll
  llvm/test/CodeGen/ARM/postrasched.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69775.227630.patch
Type: text/x-patch
Size: 11853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191103/a2dadcd0/attachment.bin>


More information about the llvm-commits mailing list