Skip to content

Commit

Permalink
CodeGen: Move check of EnablePostRAScheduler to avoid disabling antid…
Browse files Browse the repository at this point in the history
…ependency breaker

Previously, specifying -post-RA-scheduler=true had the side effect of
disabling the antidependency breaker, yielding different behavior than
if the post-RA-scheduler was enabled via the scheduling model.

Differential Revision: http://reviews.llvm.org/D20186

llvm-svn: 270077
  • Loading branch information
Mitch Bodart committed May 19, 2016
1 parent f9679e8 commit 6453501
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions llvm/lib/CodeGen/PostRASchedulerList.cpp
Expand Up @@ -103,6 +103,7 @@ namespace {

bool runOnMachineFunction(MachineFunction &Fn) override;

private:
bool enablePostRAScheduler(
const TargetSubtargetInfo &ST, CodeGenOpt::Level OptLevel,
TargetSubtargetInfo::AntiDepBreakMode &Mode,
Expand Down Expand Up @@ -269,6 +270,11 @@ bool PostRAScheduler::enablePostRAScheduler(
TargetSubtargetInfo::RegClassVector &CriticalPathRCs) const {
Mode = ST.getAntiDepBreakMode();
ST.getCriticalPathRCs(CriticalPathRCs);

// Check for explicit enable/disable of post-ra scheduling.
if (EnablePostRAScheduler.getPosition() > 0)
return EnablePostRAScheduler;

return ST.enablePostRAScheduler() &&
OptLevel >= ST.getOptLevelToEnablePostRAScheduler();
}
Expand All @@ -284,20 +290,15 @@ bool PostRAScheduler::runOnMachineFunction(MachineFunction &Fn) {

RegClassInfo.runOnMachineFunction(Fn);

// Check for explicit enable/disable of post-ra scheduling.
TargetSubtargetInfo::AntiDepBreakMode AntiDepMode =
TargetSubtargetInfo::ANTIDEP_NONE;
SmallVector<const TargetRegisterClass*, 4> CriticalPathRCs;
if (EnablePostRAScheduler.getPosition() > 0) {
if (!EnablePostRAScheduler)
return false;
} else {
// Check that post-RA scheduling is enabled for this target.
// This may upgrade the AntiDepMode.
if (!enablePostRAScheduler(Fn.getSubtarget(), PassConfig->getOptLevel(),
AntiDepMode, CriticalPathRCs))
return false;
}

// Check that post-RA scheduling is enabled for this target.
// This may upgrade the AntiDepMode.
if (!enablePostRAScheduler(Fn.getSubtarget(), PassConfig->getOptLevel(),
AntiDepMode, CriticalPathRCs))
return false;

// Check for antidep breaking override...
if (EnableAntiDepBreaking.getPosition() > 0) {
Expand Down

0 comments on commit 6453501

Please sign in to comment.