summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.h
Commit message (Collapse)AuthorAgeFilesLines
* [PGO][PGSO] Instrument the code gen / target passes.Hiroshi Yamauchi2019-12-091-0/+4
| | | | | | | | | | | | | | | | | | | | Summary: Split off of D67120. Add the profile guided size optimization instrumentation / queries in the code gen or target passes. This doesn't enable the size optimizations in those passes yet as they are currently disabled in shouldOptimizeForSize (for non-IR pass queries). A second try after reverted D71072. Reviewers: davidxl Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71149
* Revert "[PGO][PGSO] Instrument the code gen / target passes."Hiroshi Yamauchi2019-12-061-4/+0
| | | | | | This reverts commit 9a0b5e14075a1f42a72eedb66fd4fde7985d37ac. This seems to break buildbots.
* [PGO][PGSO] Instrument the code gen / target passes.Hiroshi Yamauchi2019-12-061-0/+4
| | | | | | | | | | | | | | | | | | Summary: Split off of D67120. Add the profile guided size optimization instrumentation / queries in the code gen or target passes. This doesn't enable the size optimizations in those passes yet as they are currently disabled in shouldOptimizeForSize (for non-IR pass queries). Reviewers: davidxl Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D71072
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [CodeGen] Fix inconsistent declaration parameter nameFangrui Song2018-07-161-3/+3
| | | | llvm-svn: 337200
* Change ambiguous uses of term 'funclet' to 'EH scopes'. NFC.Heejin Ahn2018-06-011-1/+1
| | | | | | | | | | | | | | | | | | Summary: `getEHScopeMembership()` function is used not only for funclet-based EHs; they apply to all EH schemes that use the scoped IR (catchpad/cleanuppad/...). D47005 (rL333045) changed some of the uses of the term 'funclet' to 'EH scopes' in case they apply to all scoped EH, and this fixes more of them. For `FuncletLayout` pass, I left it as is because the pass is only used for funclet-based EH. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47611 llvm-svn: 333711
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-011-1/+1
| | | | | | | | | | | | | | | | We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46290 llvm-svn: 331272
* [CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2017-10-101-11/+30
| | | | | | other minor fixes (NFC). llvm-svn: 315380
* Insert IMPLICIT_DEFS for undef uses in tail mergingMatthias Braun2017-09-061-4/+4
| | | | | | | | | | | | | | | | | | | | | Tail merging can convert an undef use into a normal one when creating a common tail. Doing so can make the register live out from a block which previously contained the undef use. To keep the liveness up-to-date, insert IMPLICIT_DEFs in such blocks when necessary. To enable this patch the computeLiveIns() function which used to compute live-ins for a block and set them immediately is split into new functions: - computeLiveIns() just computes the live-ins in a LivePhysRegs set. - addLiveIns() applies the live-ins to a block live-in list. - computeAndAddLiveIns() is a convenience function combining the other two functions and behaving like computeLiveIns() before this patch. Based on a patch by Krzysztof Parzyszek <kparzysz@codeaurora.org> Differential Revision: https://reviews.llvm.org/D37034 llvm-svn: 312668
* LivePhysRegs: Skip reserved regs in computeLiveIns; NFCIMatthias Braun2017-05-261-0/+1
| | | | | | | | | | Re-commit r303937 + r303949 as they were not the cause for the build failures. We do not track liveness of reserved registers so adding them to the liveins list in computeLiveIns() was completely unnecessary. llvm-svn: 303970
* Revert "LivePhysRegs: Skip reserved regs in computeLiveIns; NFCI"Matthias Braun2017-05-261-1/+0
| | | | | | | | | | Tentatively revert, suspecting that it caused breakage in stage2 buildbots. This reverts commit r303949. This reverts commit r303937. llvm-svn: 303955
* LivePhysRegs: Skip reserved regs in computeLiveIns; NFCIMatthias Braun2017-05-251-0/+1
| | | | | | | We do not track liveness of reserved registers so adding them to the liveins list in computeLiveIns() was completely unnecessary. llvm-svn: 303937
* NFC: Reformats comments according to the coding guildelines.Taewook Oh2017-03-151-0/+40
| | | | llvm-svn: 297808
* [BranchFolding] Merge debug locations from common tail instead of removingTaewook Oh2017-03-151-0/+1
| | | | | | | | | | | | | | Summary: D25742 improved the precision of debug locations for PGO by removing debug locations from common tail when tail-merging. However, if identical insturctions that are merged into a common tail have the same debug locations, there's no need to remove them. This patch creates a merged debug location of identical instructions across SameTails and assign it to the instruction in the common tail, so that the debug locations are maintained if they are same across identical instructions. Reviewers: aprantl, probinson, MatzeB, rob.lougher Reviewed By: aprantl Subscribers: andreadb, llvm-commits Differential Revision: https://reviews.llvm.org/D30226 llvm-svn: 297805
* include function name in dot filenameXinliang David Li2017-02-151-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D29975 llvm-svn: 295220
* CodeGen: Allow small copyable blocks to "break" the CFG.Kyle Butt2017-01-311-0/+1
| | | | | | | | | | | When choosing the best successor for a block, ordinarily we would have preferred a block that preserves the CFG unless there is a strong probability the other direction. For small blocks that can be duplicated we now skip that requirement as well, subject to some simple frequency calculations. Differential Revision: https://reviews.llvm.org/D28583 llvm-svn: 293716
* Add support to dump dot graph block layout after MBPXinliang David Li2017-01-291-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D29141 llvm-svn: 293408
* BranchRelaxation: Recompute live-ins when splitting a blockMatthias Braun2016-12-161-1/+0
| | | | | | | | Factors out and reuses live-in computation code from BranchFolding. Differential Revision: https://reviews.llvm.org/D27558 llvm-svn: 290013
* Do not remove implicit defs in BranchFolderKrzysztof Parzyszek2016-10-121-1/+0
| | | | | | | | | | | Branch folder removes implicit defs if they are the only non-branching instructions in a block, and the branches do not use the defined registers. The problem is that in some cases these implicit defs are required for the liveness information to be correct. Differential Revision: https://reviews.llvm.org/D25478 llvm-svn: 284036
* Branch Folding: Accept explicit threshold for tail merge size.Kyle Butt2016-08-181-3/+9
| | | | | | | | This is prep work for allowing the threshold to be different during layout, and to enforce a single threshold between merging and duplicating during layout. No observable change intended. llvm-svn: 279117
* BranchFolding: Use LivePhysReg to update live in lists.Matthias Braun2016-07-121-4/+4
| | | | | | | | | | | | | | | Use LivePhysRegs with a backwards walking algorithm to update live in lists, this way the results do not depend on the presence of kill flags anymore. This patch also reduces the number of registers added as live-in. Previously all pristine registers as well as all sub registers of a super register were added resulting in unnecessarily large live in lists. This fixed https://llvm.org/PR25263. Differential Revision: http://reviews.llvm.org/D22027 llvm-svn: 275201
* Reapply "[MBP] Reduce code size by running tail merging in MBP.""Haicheng Wu2016-06-091-6/+18
| | | | | | | | | | | | | | | | This reapplies commit r271930, r271915, r271923. They hit a bug in Thumb which is fixed in r272258 now. The original message: The code layout that TailMerging (inside BranchFolding) works on is not the final layout optimized based on the branch probability. Generally, after BlockPlacement, many new merging opportunities emerge. This patch calls Tail Merging after MBP and calls MBP again if Tail Merging merges anything. llvm-svn: 272267
* Revert "[MBP] Reduce code size by running tail merging in MBP."Haicheng Wu2016-06-071-18/+6
| | | | | | | This reverts commit r271930, r271915, r271923. They break a thumb selfhosting bot. llvm-svn: 272017
* [MBP] Reduce code size by running tail merging in MBP.Haicheng Wu2016-06-061-4/+8
| | | | | | | | | | | | | The code layout that TailMerging (inside BranchFolding) works on is not the final layout optimized based on the branch probability. Generally, after BlockPlacement, many new merging opportunities emerge. This patch calls Tail Merging after MBP and calls MBP again if Tail Merging merges anything. Differential Revision: http://reviews.llvm.org/D20276 llvm-svn: 271925
* [BranchFolding] Replace MachineBlockFrequencyInfo with MBFIWrapper. NFC.Haicheng Wu2016-06-061-2/+10
| | | | | | Differential Revision: http://reviews.llvm.org/D20184 llvm-svn: 271923
* [WinEH] Permit branch folding in the face of funcletsDavid Majnemer2015-10-041-0/+1
| | | | | | | | 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
* [CodeGen] Reduce visibility of implementation detailsBenjamin Kramer2015-07-011-1/+1
| | | | | | NFC. llvm-svn: 241164
* 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
* 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
* Canonicalize header guards into a common format.Benjamin Kramer2014-08-131-2/+2
| | | | | | | | | | Add header guards to files that were missing guards. Remove #endif comments as they don't seem common in LLVM (we can easily add them back if we decide they're useful) Changes made by clang-tidy with minor tweaks. llvm-svn: 215558
* [Branch probability] Recompute branch weights of tail-merged basic blocks.Akira Hatanaka2014-08-071-1/+23
| | | | | | | | | | | | | | | 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
* Revert "Give internal classes hidden visibility."Benjamin Kramer2013-09-111-1/+1
| | | | | | | It works with clang, but GCC has different rules so we can't make all of those hidden. This reverts commit r190534. llvm-svn: 190536
* Give internal classes hidden visibility.Benjamin Kramer2013-09-111-1/+1
| | | | | | Worth 100k on a linux/x86_64 Release+Asserts clang. llvm-svn: 190534
* [branchfolding] Fix typo in C++ editor declaration.Michael Gottesman2013-08-121-1/+1
| | | | llvm-svn: 188201
* Fix tail merging to assign the (more) correct BasicBlock when splitting.Andrew Trick2013-06-241-1/+3
| | | | | | | | | | | 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
* When tail-merging multiple blocks, make sure to correctly update the live-in ↵Eli Friedman2011-07-061-0/+2
| | | | | | | | | | list on the merged block to correctly account for the live-outs of all the predecessors. They might not be the same in all cases (the testcase I have involves a PHI node where one of the operands is an IMPLICIT_DEF). Unfortunately, the testcase I have is large and confidential, so I don't have a test to commit at the moment; I'll see if I can come up with something smaller where this issue reproduces. <rdar://problem/9716278> llvm-svn: 134565
* Add 132986 back, but avoid non-determinism if a bb address gets reused.Rafael Espindola2011-06-141-0/+2
| | | | llvm-svn: 132995
* revert 132986 to see if the bots go green.Rafael Espindola2011-06-141-2/+0
| | | | llvm-svn: 132988
* Make the threshold used by branch folding softer. Before we would get aRafael Espindola2011-06-141-0/+2
| | | | | | | sharp all or nothing transition when one extra predecessor was added. Now we still test first ones for merging. llvm-svn: 132974
* Re-commit 131172 with fix. MachineInstr identity checks should check deadEvan Cheng2011-05-121-2/+5
| | | | | | | | | markers. In some cases a register def is dead on one path, but not on another. This is passing Clang self-hosting. llvm-svn: 131214
* Revert 131172 as it is causing clang to miscompile itself. I will tryRafael Espindola2011-05-111-5/+2
| | | | | | to provide a reduced testcase. llvm-svn: 131176
* Add a late optimization to BranchFolding that hoist common instruction sequencesEvan Cheng2011-05-111-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | at the start of basic blocks to their common predecessor. It's actually quite common (e.g. about 50 times in JM/lencod) and has shown to be a nice code size benefit. e.g. pushq %rax testl %edi, %edi jne LBB0_2 ## BB#1: xorb %al, %al popq %rdx ret LBB0_2: xorb %al, %al callq _foo popq %rdx ret => pushq %rax xorb %al, %al testl %edi, %edi je LBB0_2 ## BB#1: callq _foo LBB0_2: popq %rdx ret rdar://9145558 llvm-svn: 131172
* Tail merging pass shall not break up IT blocks. rdar://8115404Evan Cheng2010-06-221-2/+3
| | | | llvm-svn: 106517
* Split tail duplication into a separate pass. This is needed to avoidBob Wilson2009-11-261-8/+0
| | | | | | | | | running tail duplication when doing branch folding for if-conversion, and we also want to be able to run tail duplication earlier to fix some reg alloc problems. Move the CanFallThrough function from BranchFolding to MachineBasicBlock so that it can be shared by TailDuplication. llvm-svn: 89904
* Perform tail duplication only once, after tail merging is complete.Bob Wilson2009-11-171-3/+2
| | | | | | | It was too difficult to keep the heuristics for merging and duplication consistent. llvm-svn: 89105
* Make the BranchFolderPass class local to BranchFolding.cpp.Dan Gohman2009-11-121-14/+1
| | | | llvm-svn: 86928
* Promote MergePotentialsElt and SameTailElt to be regular classesDan Gohman2009-11-111-2/+49
| | | | | | | instead of typedefs for std::pair. This simplifies the type of SameTails, which previously was std::vector<std::pair<std::vector<std::pair<unsigned, MachineBasicBlock *> >::iterator, MachineBasicBlock::iterator> llvm-svn: 86885
* Check in the changes to this file too.Dan Gohman2009-11-111-3/+9
| | | | llvm-svn: 86873
* Revert r85346 change to control tail merging by CodeGenOpt::Level.Bob Wilson2009-10-281-7/+3
| | | | | | I'm going to redo this using the OptimizeForSize function attribute. llvm-svn: 85426
* Record CodeGen optimization level in the BranchFolding pass so that we canBob Wilson2009-10-271-3/+7
| | | | | | | | | | | | | | | | use it to control tail merging when there is a tradeoff between performance and code size. When there is only 1 instruction in the common tail, we have been merging. That can be good for code size but is a definite loss for performance. Now we will avoid tail merging in that case when the optimization level is "Aggressive", i.e., "-O3". Radar 7338114. Since the IfConversion pass invokes BranchFolding, it too needs to know the optimization level. Note that I removed the RegisterPass instantiation for IfConversion because it required a default constructor. If someone wants to keep that for some reason, we can add a default constructor with a hard-wired optimization level. llvm-svn: 85346
OpenPOWER on IntegriCloud