[all-commits] [llvm/llvm-project] 7d9af0: [Scheduling][ARM] Consistently enable PostRA Machi...

David Green via All-commits all-commits at lists.llvm.org
Tue Nov 5 02:45:13 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7d9af03ff7a0d4fb6ae3ec224a0d8d7398bdbd84
      https://github.com/llvm/llvm-project/commit/7d9af03ff7a0d4fb6ae3ec224a0d8d7398bdbd84
  Author: David Green <david.green at arm.com>
  Date:   2019-11-05 (Tue, 05 Nov 2019)

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

  Log Message:
  -----------
  [Scheduling][ARM] Consistently enable PostRA Machine scheduling

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.

Thanks to David Penry for the identifying this problem.

Differential Revision: https://reviews.llvm.org/D69775




More information about the All-commits mailing list