summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.cpp
Commit message (Collapse)AuthorAgeFilesLines
* CodeGen: Remove implicit conversions from Analysis and BranchFoldingDuncan P. N. Exon Smith2015-10-091-24/+25
| | | | | | | | | | | | Remove a few more implicit ilist iterator conversions, this time from Analysis.cpp and BranchFolding.cpp. I added a few overloads for `remove()` and `erase()`, which quite naturally take pointers as well as iterators as parameters. This will reduce the churn at least in the short term, but I don't really have a problem with these existing for longer. llvm-svn: 249867
* [WinEH] Permit branch folding in the face of funcletsDavid Majnemer2015-10-041-13/+45
| | | | | | | | Track which basic blocks belong to which funclets. Permit branch folding to fire but only if it can prove that doing so will not cause code in one funclet to be reused in another. llvm-svn: 249257
* [WinEH] Stop BranchFolding from merging across funcletsDavid Majnemer2015-10-011-2/+4
| | | | | | | BranchFolding would merge two funclets together, this is not OK. Disable this and strengthen the assertion in FuncletLayout. llvm-svn: 249069
* [WinEH] Add and use hasEHPadSuccessor instead of getLandingPadSuccessorReid Kleckner2015-09-171-1/+1
| | | | | | | | | | | | getLandingPadSuccessor assumes that each invoke can have at most one EH pad successor, but WinEH invokes can have more than one. Two out of three callers of getLandingPadSuccessor don't use the returned landingpad, so we can make them use this simple predicate instead. Eventually we'll have to circle back and fix SplitKit.cpp so that register allocation works. Baby steps. llvm-svn: 247904
* Use range-based for loops. NFCCraig Topper2015-09-161-47/+31
| | | | llvm-svn: 247772
* [WinEH] Add some support for code generating catchpadReid Kleckner2015-08-271-6/+6
| | | | | | | We can now run 32-bit programs with empty catch bodies. The next step is to change PEI so that we get funclet prologues and epilogues. llvm-svn: 246235
* fix minsize detection: minsize attribute implies optimizing for sizeSanjay Patel2015-08-101-3/+1
| | | | llvm-svn: 244528
* wrap OptSize and MinSize attributes for easier and consistent access (NFCI)Sanjay Patel2015-08-041-0/+1
| | | | | | | | | | | | | | | | | Create wrapper methods in the Function class for the OptimizeForSize and MinSize attributes. We want to hide the logic of "or'ing" them together when optimizing just for size (-Os). Currently, we are not consistent about this and rely on a front-end to always set OptimizeForSize (-Os) if MinSize (-Oz) is on. Thus, there are 18 FIXME changes here that should be added as follow-on patches with regression tests. This patch is NFC-intended: it just replaces existing direct accesses of the attributes by the equivalent wrapper call. Differential Revision: http://reviews.llvm.org/D11734 llvm-svn: 243994
* Roll forward r242871Jingyue Wu2015-07-291-18/+35
| | | | | | | r242871 missed one place that should be guarded with isPhysicalReg. This patch fixes that. llvm-svn: 243555
* Temporarily revert r242871Jingyue Wu2015-07-291-28/+15
| | | | | | PR24299 llvm-svn: 243522
* [BranchFolding] do not iterate the aliases of virtual registersJingyue Wu2015-07-221-15/+28
| | | | | | | | | | | | | | | | | Summary: MCRegAliasIterator only works for physical registers. So, do not run it on virtual registers. With this issue fixed, we can resurrect the BranchFolding pass in NVPTX backend. Reviewers: jholewinski, bkramer Subscribers: henryhu, meheff, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D11174 llvm-svn: 242871
* [BranchFolding] Document why replacing HashMachineInstr with hash_code ↵Benjamin Kramer2015-06-231-1/+3
| | | | | | doesn't work llvm-svn: 240415
* [MachineBasicBlock] Add getFirstNonDebugInstr to complement getLastNonDebugInstrBenjamin Kramer2015-06-231-57/+18
| | | | | | Use it in CodeGen where applicable. No functionality change intended. llvm-svn: 240414
* Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)Alexander Kornienko2015-06-231-1/+1
| | | | | | Apparently, the style needs to be agreed upon first. llvm-svn: 240390
* Reformat.NAKAMURA Takumi2015-06-201-7/+12
| | | | llvm-svn: 240213
* Revert r240040, "[BranchFolding] Replace custom MachineInstr with ↵NAKAMURA Takumi2015-06-201-6/+46
| | | | | | | | MachineInstrExpressionTrait" It caused different emission between stage2 and stage3. Investigating. llvm-svn: 240212
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-191-1/+1
| | | | | | | | | | | | | 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
* [BranchFolding] Replace custom MachineInstr with MachineInstrExpressionTraitBenjamin Kramer2015-06-181-46/+6
| | | | | | | While the hash functions are subtly different it shouldn't have an impact. Instructions are checked with isIdenticalTo later. llvm-svn: 240040
* MachineInstr: Remove unused parameter.Matthias Braun2015-05-191-3/+2
| | | | llvm-svn: 237726
* Don't rewrite jumps to empty BBs to landing pads.Pete Cooper2015-04-301-0/+5
| | | | | | | | | | | | In the test case here, the 'unreachable' BB was removed by BranchFolding because its empty. It then rewrote the jump from 'entry' to jump to its fallthrough, which was a landing pad. This results in 'entry' jumping to 2 different landing pads, which fails the machine verifier. rdar://problem/20750162 llvm-svn: 236248
* BranchFolding: MergePotentialsElt has a total order, just call array_pod_sort.Benjamin Kramer2015-03-131-1/+1
| | | | | | No functionality change intended. llvm-svn: 232217
* Don't evaluate rend() on every iteration of the loop.Chad Rosier2015-03-101-1/+3
| | | | llvm-svn: 231837
* [BranchFolding] Remove MMOs during tail merge to preserve dependencies.Chad Rosier2015-03-101-0/+57
| | | | | | | | | | | | | | | | | | When tail merging it may be necessary to remove MMOs from memory operations to ensures later passes (e.g., MI sched) conservatively compute dependencies. Currently, we only remove the MMO from the common tail if the MMO doesn't match with the relative instruction in the non-common tail(s). A more robust solution would be to add multiple MMOs from the duplicate MIs to the new MI. Currently ScheduleDAGInstrs.cpp ignores all MMOs on instructions with multiple MMOs, so this solution is equivalent for the time being. No test case included as this is incredibly difficult to reproduce. Patch was a collaborative effort between Ana Pazos and myself. Phabricator: http://reviews.llvm.org/D7769 llvm-svn: 231799
* CodeGen: Canonicalize access to function attributes, NFCDuncan P. N. Exon Smith2015-02-141-2/+1
| | | | | | | | | | | | | | | | | Canonicalize access to function attributes to use the simpler API. getAttributes().getAttribute(AttributeSet::FunctionIndex, Kind) => getFnAttribute(Kind) getAttributes().hasAttribute(AttributeSet::FunctionIndex, Kind) => hasFnAttribute(Kind) Also, add `Function::getFnStackAlignment()`, and canonicalize: getAttributes().getStackAlignment(AttributeSet::FunctionIndex) => getFnStackAlignment() llvm-svn: 229208
* Update SetVector to rely on the underlying set's insert to return a ↵David Blaikie2014-11-191-1/+1
| | | | | | | | | | | | | pair<iterator, bool> This is to be consistent with StringSet and ultimately with the standard library's associative container insert function. This lead to updating SmallSet::insert to return pair<iterator, bool>, and then to update SmallPtrSet::insert to return pair<iterator, bool>, and then to update all the existing users of those functions... llvm-svn: 222334
* Remove unnecessary TargetMachine.h includes.Eric Christopher2014-10-141-1/+0
| | | | llvm-svn: 219672
* [Branch probability] Recompute branch weights of tail-merged basic blocks.Akira Hatanaka2014-08-071-5/+72
| | | | | | | | | | | | | | | BranchFolderPass was not correctly setting the basic block branch weights when tail-merging created or merged blocks. This patch recomutes the weights of tail-merged blocks using the following formula: branch_weight(merged block to successor j) = sum(block_frequency(bb) * branch_probability(bb -> j)) bb is a block that is in the set of merged blocks. <rdar://problem/16256423> llvm-svn: 215135
* Have MachineFunction cache a pointer to the subtarget to make lookupsEric Christopher2014-08-051-4/+3
| | | | | | | | | | | 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
* Changed the liveness tracking in the RegisterScavengerPedro Artigas2014-08-041-4/+2
| | | | | | | | to use register units instead of registers. reviewed by Jakob Stoklund Olesen. llvm-svn: 214798
* Remove the TargetMachine forwards for TargetSubtargetInfo basedEric Christopher2014-08-041-4/+5
| | | | | | information and update all callers. No functional change. llvm-svn: 214781
* Prevent hoisting the instruction whose def might be clobbered by the terminator.Sasa Stankovic2014-06-051-4/+11
| | | | llvm-svn: 210261
* [Modules] Remove potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-221-1/+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
* [C++11] More 'nullptr' conversion. In some cases just using a boolean check ↵Craig Topper2014-04-141-35/+36
| | | | | | instead of comparing to nullptr. llvm-svn: 206142
* Disable each MachineFunctionPass for 'optnone' functions, unless thatPaul Robinson2014-03-311-0/+3
| | | | | | | pass normally runs at optimization level None, or is part of the register allocation pipeline. llvm-svn: 205228
* This is a fix for PR# 19051. I noticed code gen differences due to code ↵Ekaterina Romanova2014-03-261-1/+1
| | | | | | motion when running tests with and without the debug info at O2. The problem is in branch folding. A loop wanted to skip the debug info, but actually it didn't do so. llvm-svn: 204865
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-071-2/+2
| | | | | | class. llvm-svn: 203220
* [C++11] Replace llvm::next and llvm::prior with std::next and std::prev.Benjamin Kramer2014-03-021-17/+17
| | | | | | Remove the old functions. llvm-svn: 202636
* Add a RequireStructuredCFG Field to TargetMachine.Vincent Lejeune2013-12-071-1/+5
| | | | llvm-svn: 196634
* Fix tail merging to assign the (more) correct BasicBlock when splitting.Andrew Trick2013-06-241-4/+11
| | | | | | | | | | | This makes it possible to write unit tests that are less susceptible to minor code motion, particularly copy placement. block-placement.ll covers this case with -pre-RA-sched=source which will soon be default. One incorrectly named block is already fixed, but without this fix, enabling new coalescing and scheduling would cause more failures. llvm-svn: 184680
* Simplify logic now that r182490 is in place. No functional change intended.Chad Rosier2013-05-221-2/+2
| | | | llvm-svn: 182531
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. llvm-svn: 171366
* Remove the Function::getFnAttributes method in favor of using the AttributeSetBill Wendling2012-12-301-2/+2
| | | | | | | | | directly. This is in preparation for removing the use of the 'Attribute' class as a collection of attributes. That will shift to the AttributeSet class instead. llvm-svn: 171253
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-191-1/+1
| | | | | | single attribute in the future. llvm-svn: 170502
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-9/+9
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] llvm-svn: 169131
* Remove unneeded #include.Jakub Staszak2012-11-271-1/+0
| | | | llvm-svn: 168670
* Create enums for the different attributes.Bill Wendling2012-10-091-1/+2
| | | | | | | We use the enums to query whether an Attributes object has that attribute. The opaque layer is responsible for knowing where that specific attribute is stored. llvm-svn: 165488
* Fix indentation. Remove 'else' after return. No functional change.Craig Topper2012-10-071-11/+8
| | | | llvm-svn: 165381
* Remove the `hasFnAttr' method from Function.Bill Wendling2012-09-261-1/+1
| | | | | | | The hasFnAttr method has been replaced by querying the Attributes explicitly. No intended functionality change. llvm-svn: 164725
* Reduce duplicated hash map lookups.Benjamin Kramer2012-08-221-2/+1
| | | | llvm-svn: 162362
* Fix typos found by http://github.com/lyda/misspell-checkBenjamin Kramer2012-06-021-1/+1
| | | | llvm-svn: 157885
OpenPOWER on IntegriCloud