[PATCH] D14928: [PostRA scheduling] Allow a subtarget to do scheduling when it wants post RA

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 26 01:10:30 PST 2015

jonpa updated this revision to Diff 41212.
jonpa added a comment.

updates as requested, however some new concerns:

I guess it would make sense to also allow the PostRAScheduler pass to be run at a later point. I tried to do this, but it became very weird to try to override the options.

It is very confusing that these passes are always inserted into the pass list, and then controlled by an option to 'not run'. To then in turn override that option - like this patch is doing - only gives the expected behaviour (the scheduler running once at the point specified by the target), as long as the *other* scheding pass is inserted at the standard point. Otherwise, it would run twice! This doesn't seem acceptable.

It would also be nice to use the same command line options regardless of where the pass is run, which is not possible as long as the options are needed to 'not run' the pass.

Perhaps one way would be to let TargetMachine specify to TargetPassConfig to disable the standard insertion of post-ra scheduler pass? That would work for SystemZ, at least. This would work as long as all subtargets follow the same behaviour.  What do you think?



Index: lib/CodeGen/MachineScheduler.cpp
--- lib/CodeGen/MachineScheduler.cpp
+++ lib/CodeGen/MachineScheduler.cpp
@@ -352,7 +352,8 @@
   if (skipOptnoneFunction(*mf.getFunction()))
     return false;
-  if (!mf.getSubtarget().enablePostRAScheduler()) {
+  if (!mf.getSubtarget().enablePostRAScheduler() &&
+      !mf.getSubtarget().targetSchedulesPostRAScheduling()) {
     DEBUG(dbgs() << "Subtarget disables post-MI-sched.\n");
     return false;
Index: include/llvm/Target/TargetSubtargetInfo.h
--- include/llvm/Target/TargetSubtargetInfo.h
+++ include/llvm/Target/TargetSubtargetInfo.h
@@ -135,6 +135,14 @@
   /// which is the preferred way to influence this.
   virtual bool enablePostRAScheduler() const;
+  /// True if subtarget inserts the final scheduling pass on its own
+  /// instead of returning true in enablePostRAScheduler().
+  ///
+  /// Branch relaxation, which must happen after block placement, can
+  /// on some targets (e.g. SystemZ) expose additional post-RA
+  /// scheduling opportunities.
+  virtual bool targetSchedulesPostRAScheduling() const { return false;};
   /// \brief True if the subtarget should run the atomic expansion pass.
   virtual bool enableAtomicExpand() const;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14928.41212.patch
Type: text/x-patch
Size: 1358 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151126/01ff5de0/attachment.bin>

More information about the llvm-commits mailing list