aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineScheduler.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-07-20MachineScheduler: Restrict macroop fusion to data-dependent instructions.Matthias Braun1-9/+33
Before creating a schedule edge to encourage MacroOpFusion check that: - The predecessor actually writes a register that the branch reads. - The predecessor has no successors in the ScheduleDAG so we can schedule it in front of the branch. This avoids skewing the scheduling heuristic in cases where macroop fusion cannot happen. Differential Revision: http://reviews.llvm.org/D10745 llvm-svn: 242723
2015-06-23Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko1-3/+3
Apparently, the style needs to be agreed upon first. llvm-svn: 240390
2015-06-19Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko1-3/+3
The patch is generated using this command: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ llvm/lib/ Thanks to Eugene Kosov for the original patch! llvm-svn: 240137
2015-06-19Fix "the the" in comments.Eric Christopher1-1/+1
llvm-svn: 240112
2015-06-15[TargetInstrInfo] Rename getLdStBaseRegImmOfs and implement for x86.Sanjoy Das1-1/+1
Summary: TargetInstrInfo::getLdStBaseRegImmOfs to TargetInstrInfo::getMemOpBaseRegImmOfs and implement for x86. The implementation only handles a few easy cases now and will be made more sophisticated in the future. This is NFCI: the only user of `getLdStBaseRegImmOfs` (now `getmemOpBaseRegImmOfs`) is `LoadClusterMotion` and `LoadClusterMotion` is disabled for x86. Reviewers: reames, ab, MatzeB, atrick Reviewed By: MatzeB, atrick Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10199 llvm-svn: 239741
2015-06-13Rename TargetSubtargetInfo::enablePostMachineScheduler() to ↵Matthias Braun1-1/+1
enablePostRAScheduler() r213101 changed the behaviour of this method to not only affect the PostMachineScheduler scheduler but also the PostRAScheduler scheduler, renaming should make this fact clear. Also document that the preferred way is to specify this in the scheduling model instead of overriding this method. Differential Revision: http://reviews.llvm.org/D10427 llvm-svn: 239659
2015-05-17MachineScheduler debug output clarity.Andrew Trick1-2/+3
llvm-svn: 237545
2015-05-17RegisterPressureTracker: reword stale comments.Andrew Trick1-2/+1
llvm-svn: 237544
2015-03-27Complete the MachineScheduler fix made way back in r210390.Andrew Trick1-2/+2
"Fix the MachineScheduler's logic for updating ready times for in-order. Now the scheduler updates a node's ready time as soon as it is scheduled, before releasing dependent nodes." This fix was only made in one variant of the ScheduleDAGMI driver. Francois de Ferriere reported the issue in the other bit of code where it was also needed. I never got around to coming up with a test case, but it's an obvious fix that shouldn't be delayed any longer. I'll try to refactor this code a little better. I did verify performance on a wide variety of targets and saw no negative impact with this fix. llvm-svn: 233366
2015-03-11Remove useMachineScheduler and replace it with subtarget optionsEric Christopher1-0/+11
that control, individually, all of the disparate things it was controlling. At the same time move a FIXME in the Hexagon port to a new subtarget function that will enable a user of the machine scheduler to avoid using the source scheduler for pre-RA-scheduling. The FIXME would have this removed, but involves either testcase changes or adding -pre-RA-sched=source to a few testcases. llvm-svn: 231980
2015-01-27The subtarget is cached on the MachineFunction. Access it directly.Eric Christopher1-3/+1
llvm-svn: 227173
2015-01-19[MIScheduler] Slightly better handling of constrainLocalCopy when both ↵Michael Kuperstein1-4/+7
source and dest are local This fixes PR21792. Differential Revision: http://reviews.llvm.org/D6823 llvm-svn: 226433
2014-12-13Rename argument strings of codegen passes to avoid collisions with command lineAkira Hatanaka1-2/+2
options. This commit changes the command line arguments (PassInfo::PassArgument) of two passes, MachineFunctionPrinter and MachineScheduler, to avoid collisions with command line options that have the same argument strings. This bug manifests when the PassList construct (defined in opt.cpp) is used in a tool that links with codegen passes. To reproduce the bug, paste the following lines into llc.cpp and run llc. #include "llvm/IR/LegacyPassNameParser.h" static llvm::cl::list<const llvm::PassInfo*, bool, llvm::PassNameParser> PassList(llvm::cl::desc("Optimizations available:")); rdar://problem/19212448 llvm-svn: 224186
2014-12-12Reapply "[MachineScheduler] Fix for PR21807: minor code difference building ↵Andrea Di Biagio1-1/+3
with/without -g." This reapplies r224118 with a fix for test 'misched-code-difference-with-debug.ll'. That test was failing on some buildbots because it was x86 specific but it was missing a target triple. Added an explicit triple to test misched-code-difference-with-debug.ll. llvm-svn: 224126
2014-12-12Revert: [MachineScheduler] Fix for PR21807: minor code difference building ↵Andrea Di Biagio1-3/+1
with/without -g. Test 'misched-code-difference-with-debug.ll' was failing on some buildbots. llvm-svn: 224121
2014-12-12[MachineScheduler] Fix for PR21807: minor code difference building ↵Andrea Di Biagio1-1/+3
with/without -g. This patch fixes the issue reported as PR21807. There was a minor difference in the generated code depending on the -g flag. The cause was that with -g the machine scheduler used a different scheduling strategy. This decision was based on the number of instructions in a schedule region and included debug instructions in that count. This patch fixes the issue in MISched and provides a test. Patch by Russell Gallop! llvm-svn: 224118
2014-10-14Access the subtarget off of the MachineFunction via the DAGEric Christopher1-9/+7
scheduler or via the SelectionDAG if available. Otherwise grab the subtarget off of the MachineFunction by going up the parent chain. llvm-svn: 219666
2014-10-10[MiSched] Fix a logic error in tryPressure()Hal Finkel1-2/+2
Fixes a logic error in the MachineScheduler found by Steve Montgomery (and confirmed by Andy). This has gone unfixed for months because the fix has been found to introduce some small performance regressions. However, Andy has recommended that, at this point, we fix this to avoid further dependence on the incorrect behavior (and then follow-up separately on any regressions), and I agree. Fixes PR18883. llvm-svn: 219512
2014-08-07Debugging Utility - optional ability for dumping critical path lengthGerolf Hoflehner1-2/+16
llvm-svn: 215153
2014-08-05Have MachineFunction cache a pointer to the subtarget to make lookupsEric Christopher1-2/+1
shorter/easier and have the DAG use that to do the same lookup. This can be used in the future for TargetMachine based caching lookups from the MachineFunction easily. Update the MIPS subtarget switching machinery to update this pointer at the same time it runs. llvm-svn: 214838
2014-08-04Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher1-5/+9
information and update all callers. No functional change. llvm-svn: 214781
2014-07-02Revert "Revert "MachineScheduler: better book-keeping for asserts.""Chad Rosier1-7/+11
This reverts commit r212109, which reverted r212088. However, disable the assert as it's not necessary for correctness. There are several corner cases that the assert needed to handle better for in-order scheduling, but none of them are incorrect scheduler behavior. The assert is mainly there to collect good unit tests like this and ensure that the target-independent scheduler is working as expected with the various machine models. llvm-svn: 212187
2014-07-01Move remaining LLVM_ENABLE_DUMP conditionals out of the headersAlp Toker1-2/+1
This macro is sometimes defined manually but isn't (and doesn't need to be) in llvm-config.h so shouldn't appear in the headers, likewise NDEBUG. Instead switch them over to LLVM_DUMP_METHOD on the definitions. llvm-svn: 212130
2014-07-01Revert "MachineScheduler: better book-keeping for asserts."Chad Rosier1-7/+5
This reverts commit r212088, which is causing a number of spec failures. Will provide reduced test cases shortly. PR20057 llvm-svn: 212109
2014-07-01MachineScheduler: better book-keeping for asserts.Andrew Trick1-5/+7
Fixes another test case under PR20057. llvm-svn: 212088
2014-06-27Left out the NDEBUG in the previous checkin.Andrew Trick1-0/+2
llvm-svn: 211867
2014-06-27MachineScheduler: add some book-keeping to fix an assert.Andrew Trick1-1/+7
Fixe for Bug 20057 - Assertion failied in llvm::SUnit* llvm::SchedBoundary::pickOnlyChoice(): Assertion `i <= (HazardRec->getMaxLookAhead() + MaxObservedStall) && "permanent hazard"' Thanks to Chad for the test case. llvm-svn: 211865
2014-06-26Revert "Introduce a string_ostream string builder facilty"Alp Toker1-1/+2
Temporarily back out commits r211749, r211752 and r211754. llvm-svn: 211814
2014-06-26Introduce a string_ostream string builder faciltyAlp Toker1-2/+1
string_ostream is a safe and efficient string builder that combines opaque stack storage with a built-in ostream interface. small_string_ostream<bytes> additionally permits an explicit stack storage size other than the default 128 bytes to be provided. Beyond that, storage is transferred to the heap. This convenient class can be used in most places an std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair would previously have been used, in order to guarantee consistent access without byte truncation. The patch also converts much of LLVM to use the new facility. These changes include several probable bug fixes for truncated output, a programming error that's no longer possible with the new interface. llvm-svn: 211749
2014-06-12Fix the scheduler's MaxObservedStall computation.Andrew Trick1-2/+6
WenHan Gu pointed out this bug that results in an assert not being effective in some cases. llvm-svn: 210846
2014-06-07Fix the MachineScheduler's logic for updating ready times for in-order.Andrew Trick1-32/+25
Now the scheduler updates a node's ready time as soon as it is scheduled, before releasing dependent nodes. There was a reason I didn't do this initially but it no longer applies. A53 is in-order and was running into an issue where nodes where added to the readyQ too early. That's now fixed. This also makes it easier for custom scheduling strategies to build heuristics based on the actual cycles that the node was scheduled at. The only impact on OOO (sandybridge/cyclone) is that ready times will be slightly more accurate. I didn't measure any significant regressions. llvm-svn: 210390
2014-06-04Add a subtarget hook: enablePostMachineScheduler.Andrew Trick1-0/+6
As requested by AArch64 subtargets. Note that this will have no effect until the AArch64 target actually enables the pass like this: substitutePass(&PostRASchedulerID, &PostMachineSchedulerID); As soon as armv7 switches over, PostMachineScheduler will become the default postRA scheduler, so this won't be necessary any more. Targets using the old postRA schedule would then do: substitutePass(&PostMachineSchedulerID, &PostRASchedulerID); llvm-svn: 210167
2014-06-04Move GenericScheduler and PostGenericScheduler into a header.Andrew Trick1-229/+15
These were not exposed previously because I didn't want out-of-tree targets to be too dependent on their internals. They can be reused for a very wide variety of processors with casual scheduling needs without exposing the classes by instead using hooks defined in MachineSchedPolicy (we can add more if needed). When targets are more aggressively tuned or want to provide custom heuristics, they can define their own MachineSchedStrategy. I tend to think this is better once you start customizing heuristics because you can copy over only what you need. I don't think that layering heuristics generally works well. However, Arch64 targets now want to reuse the Generic scheduling logic but also provide extensions. I don't see much harm in exposing the Generic scheduling classes with a major caveat: these scheduling strategies may change in the future without validating performance on less mainstream processors. If you want to be immune from changes, just define your own MachineSchedStrategy. llvm-svn: 210166
2014-04-29[C++11] Add 'override' keywords and remove 'virtual'. Additionally add ↵Craig Topper1-5/+5
'final' and leave 'virtual' on some methods that are marked virtual without overriding anything and have no obvious overrides themselves. llvm-svn: 207511
2014-04-22[Modules] Remove potential ODR violations by sinking the DEBUG_TYPEChandler Carruth1-2/+2
define below all header includes in the lib/CodeGen/... tree. While the current modules implementation doesn't check for this kind of ODR violation yet, it is likely to grow support for it in the future. It also removes one layer of macro pollution across all the included headers. Other sub-trees will follow. llvm-svn: 206837
2014-04-21Use unique_ptr to manage objects owned by the ScheduleDAGMI.David Blaikie1-10/+9
llvm-svn: 206784
2014-04-14[C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper1-24/+25
instead of comparing to nullptr. llvm-svn: 206142
2014-03-31Disable each MachineFunctionPass for 'optnone' functions, unless thatPaul Robinson1-0/+3
pass normally runs at optimization level None, or is part of the register allocation pipeline. llvm-svn: 205228
2014-03-10[C++11] Remove 'virtual' keyword from methods marked with 'override' keyword.Craig Topper1-21/+21
llvm-svn: 203444
2014-03-07[C++11] Convert sort predicates into lambdas.Benjamin Kramer1-11/+5
No functionality change. llvm-svn: 203288
2014-03-07[C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper1-15/+15
class. llvm-svn: 203220
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles1-3/+2
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
2014-03-02[C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer1-11/+10
Remove the old functions. llvm-svn: 202636
2014-03-02Switch all uses of LLVM_OVERRIDE to just use 'override' directly.Craig Topper1-17/+17
llvm-svn: 202621
2014-01-24Fix known typosAlp Toker1-1/+1
Sweep the codebase for common typos. Includes some changes to visible function names that were misspelt. llvm-svn: 200018
2014-01-22Reformat a loop for basic hygeine. Self review.Andrew Trick1-5/+5
llvm-svn: 199788
2014-01-21Fix PR18572 - llc crash during GenericScheduler::initPolicy().Andrew Trick1-4/+10
Generalized the heuristic that looks at the (very rough) size of the register file before enabling regpressure tracking. llvm-svn: 199766
2013-12-28CodeGen: silence a C++11 feature warningSaleem Abdulrasool1-1/+1
llvm-svn: 198133
2013-12-28Uninitialized variable (in never taken path) after factoring.Andrew Trick1-1/+1
llvm-svn: 198131
2013-12-28Added debugging options: -misched-only-func/blockAndrew Trick1-0/+13
llvm-svn: 198124