summaryrefslogtreecommitdiffstats
path: root/llvm
Commit message (Collapse)AuthorAgeFilesLines
* Completely re-write the algorithm behind MachineBlockPlacement based onChandler Carruth2011-10-232-401/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | discussions with Andy. Fundamentally, the previous algorithm is both counter productive on several fronts and prioritizing things which aren't necessarily the most important: static branch prediction. The new algorithm uses the existing loop CFG structure information to walk through the CFG itself to layout blocks. It coalesces adjacent blocks within the loop where the CFG allows based on the most likely path taken. Finally, it topologically orders the block chains that have been formed. This allows it to choose a (mostly) topologically valid ordering which still priorizes fallthrough within the structural constraints. As a final twist in the algorithm, it does violate the CFG when it discovers a "hot" edge, that is an edge that is more than 4x hotter than the competing edges in the CFG. These are forcibly merged into a fallthrough chain. Future transformations that need te be added are rotation of loop exit conditions to be fallthrough, and better isolation of cold block chains. I'm also planning on adding statistics to model how well the algorithm does at laying out blocks based on the probabilities it receives. The old tests mostly still pass, and I have some new tests to add, but the nested loops are still behaving very strangely. This almost seems like working-as-intended as it rotated the exit branch to be fallthrough, but I'm not convinced this is actually the best layout. It is well supported by the probabilities for loops we currently get, but those are pretty broken for nested loops, so this may change later. llvm-svn: 142743
* Add X86 RORX instructionCraig Topper2011-10-239-14/+109
| | | | llvm-svn: 142741
* The element insertion code in scalar replacement doesn't handle incorrectCameron Zwarich2011-10-232-2/+23
| | | | | | | element types, even though the element extraction code does. It is surprising that this bug has been here for so long. Fixes <rdar://problem/10318778>. llvm-svn: 142740
* Add X86 MULX instruction for disassembler.Craig Topper2011-10-233-0/+48
| | | | llvm-svn: 142738
* Remove some duplicate specifying of neverHasSideEffects and mayLoad from X86 ↵Craig Topper2011-10-221-5/+5
| | | | | | multiply instructions. llvm-svn: 142737
* Oops! Fix test I forgot to submit as part of r142735.Nick Lewycky2011-10-221-2/+2
| | | | llvm-svn: 142736
* A non-escaping malloc in the entry block is not unlike an alloca. Do dead-storeNick Lewycky2011-10-222-2/+33
| | | | | | elimination on them too. llvm-svn: 142735
* Make SCEV's brute force analysis stronger in two ways. Firstly, we should beNick Lewycky2011-10-222-26/+178
| | | | | | | | | | | | | | | | able to constant fold load instructions where the argument is a constant. Second, we should be able to watch multiple PHI nodes through the loop; this patch only supports PHIs in loop headers, more can be done here. With this patch, we now constant evaluate: static const int arr[] = {1, 2, 3, 4, 5}; int test() { int sum = 0; for (int i = 0; i < 5; ++i) sum += arr[i]; return sum; } llvm-svn: 142731
* Fix a typo.wNadav Rotem2011-10-221-1/+1
| | | | llvm-svn: 142729
* Minor updates.Jim Grosbach2011-10-221-0/+2
| | | | llvm-svn: 142728
* Added my name to CREDITS.TXTNadav Rotem2011-10-221-0/+4
| | | | llvm-svn: 142727
* Move various generated tables into read-only memory, fixing up const ↵Benjamin Kramer2011-10-226-34/+40
| | | | | | correctness along the way. llvm-svn: 142726
* Fix pr11193.Nadav Rotem2011-10-222-3/+15
| | | | | | | SHL inserts zeros from the right, thus even when the original sign_extend_inreg value was of 1-bit, we need to sra. llvm-svn: 142724
* The different flavors of ARM have different valid subsets of registers. CheckBill Wendling2011-10-221-3/+13
| | | | | | | that the set of callee-saved registers is correct for the specific platform. <rdar://problem/10313708> & ctor_dtor_count & ctor_dtor_count-2 llvm-svn: 142706
* Assembly parsing for 4-register sequential variant of VLD2.Jim Grosbach2011-10-214-42/+24
| | | | llvm-svn: 142704
* Assembly parsing for 2-register sequential variant of VLD2.Jim Grosbach2011-10-216-37/+54
| | | | llvm-svn: 142691
* Make sure that the landing pads themselves have no PHI instructions in them.Bill Wendling2011-10-211-0/+21
| | | | | | | | The assumption in the back-end is that PHIs are not allowed at the start of the landing pad block for SjLj exceptions. <rdar://problem/10313708> llvm-svn: 142689
* Extend the floating point heuristic to consider NaN checks unlikely.Benjamin Kramer2011-10-211-4/+17
| | | | llvm-svn: 142687
* Revert r141657 for now. This has broken css and changed links on llvm.org. ↵Tanya Lattner2011-10-211-826/+613
| | | | | | I'd like to understand exactly why the links have changed and if a newer doxygen is required. This may be reapplied once we upgrade on llvm.org and it is fully tested. llvm-svn: 142686
* Remap blockaddress correctly when inlining a function. Fixes PR10162.Eli Friedman2011-10-212-1/+59
| | | | llvm-svn: 142684
* Use LLVMBool for a function that logically returns a boolean value.Owen Anderson2011-10-212-2/+2
| | | | llvm-svn: 142683
* Assembly parsing for 4-register variant of VLD1.Jim Grosbach2011-10-218-31/+48
| | | | llvm-svn: 142682
* Fix typo.Owen Anderson2011-10-211-1/+1
| | | | llvm-svn: 142681
* BranchProbabilityInfo: floating point equality is unlikely.Benjamin Kramer2011-10-211-2/+34
| | | | | | This is from the same paper from Ball and Larus as the rest of the currently implemented heuristics. llvm-svn: 142677
* Assembly parsing for 3-register variant of VLD1.Jim Grosbach2011-10-218-23/+46
| | | | llvm-svn: 142675
* STABS symbols are debug symbols.Owen Anderson2011-10-211-1/+3
| | | | llvm-svn: 142673
* Minor simplification: use ShuffleVectorInst::getMaskValue instead of a more ↵Eli Friedman2011-10-211-2/+2
| | | | | | expensive helper. llvm-svn: 142672
* Extend instcombine's shufflevector simplification to handle more cases where ↵Eli Friedman2011-10-212-61/+241
| | | | | | the input and output vectors have different sizes. Patch by Xiaoyi Guo. llvm-svn: 142671
* ARM VLD parsing and encoding.Jim Grosbach2011-10-218-255/+285
| | | | | | | | | | | | Next step in the ongoing saga of NEON load/store assmebly parsing. Handle VLD1 instructions that take a two-register register list. Adjust the instruction definitions to only have the single encoded register as an operand. The super-register from the pseudo is kept as an implicit def, so passes which come after pseudo-expansion still know that the instruction defines the other subregs. llvm-svn: 142670
* Don't automatically set the "fc" bits on MSR instructions if the user didn't ↵Owen Anderson2011-10-211-3/+7
| | | | | | ask for them. This is a divergence from gas' behavior, but it is correct per the documentation and allows us to forge ahead with roundtrip testing. llvm-svn: 142669
* Bind libObject API for obtaining the section containing a Symbol.Owen Anderson2011-10-212-0/+8
| | | | llvm-svn: 142667
* Expand the coverage of the libObject C bindings to include more SectionRef ↵Owen Anderson2011-10-212-2/+100
| | | | | | accessors as well as Symbol iterators. llvm-svn: 142661
* Fix pr11194. When promoting and splitting integers we need to useNadav Rotem2011-10-212-3/+31
| | | | | | | | ZExtPromotedInteger and SExtPromotedInteger based on the operation we legalize. SetCC return type needs to be legalized via PromoteTargetBoolean. llvm-svn: 142660
* Nuke an #if0 that got accidentally left in.Jim Grosbach2011-10-211-31/+0
| | | | llvm-svn: 142658
* whitespace.Jim Grosbach2011-10-211-1/+1
| | | | llvm-svn: 142657
* Don't hard code the desired alignment for loops -- it isn't 16-bytes onChandler Carruth2011-10-211-3/+3
| | | | | | all x86 systems. Sorry for the breakage. llvm-svn: 142656
* Remove some outdated comments.Jim Grosbach2011-10-211-11/+11
| | | | llvm-svn: 142653
* 1. Fix the widening of SETCC in WidenVecOp_SETCC. Use the correct return CC ↵Nadav Rotem2011-10-214-14/+47
| | | | | | | | type. 2. Fix a typo in CONCAT_VECTORS which exposed the bug in #1. llvm-svn: 142648
* Ensure timestamps are not embedded into files when doing a release build.Duncan Sands2011-10-211-0/+1
| | | | llvm-svn: 142647
* Fix build on mingw-w64.Anton Korobeynikov2011-10-211-6/+8
| | | | | | Patch by Ruben Van Boxem! llvm-svn: 142646
* Add loop aligning to MachineBlockPlacement based on review discussion soChandler Carruth2011-10-212-5/+108
| | | | | | | | | | | | | | | | | | | it's a bit more plausible to use this instead of CodePlacementOpt. The code for this was shamelessly stolen from CodePlacementOpt, and then trimmed down a bit. There doesn't seem to be much utility in returning true/false from this pass as we may or may not have rewritten all of the blocks. Also, the statistic of counting how many loops were aligned doesn't seem terribly important so I removed it. If folks would like it to be included, I'm happy to add it back. This was probably the most egregious of the missing features, and now I'm going to start gathering some performance numbers and looking at specific loop structures that have different layout between the two. Test is updated to include both basic loop alignment and nested loop alignment. llvm-svn: 142645
* Add a very basic test for MachineBlockPlacement. This is essentially theChandler Carruth2011-10-211-0/+75
| | | | | | | | | | | | | | | | | canonical example I used when developing it, and is one of the primary motivating real-world use cases for __builtin_expect (when burried under a macro). I'm working on more test cases here, but I'm trying to make sure both that the pass is doing the right thing with the test cases and that they aren't too brittle to changes elsewhere in the code generation pipeline. Feedback and/or suggestions on how to test this are very welcome. Especially feedback on whether testing the block comments is a good strategy; I couldn't find any good examples to steal from but all the other ideas I had were a lot uglier or more fragile. llvm-svn: 142644
* Modify the script to output the regressions and passes into categories. My ↵Bill Wendling2011-10-211-9/+44
| | | | | | Python-fu could use some improving... llvm-svn: 142643
* Remove intrinsics for X86 BLSI, BLSMSK, and BLSR intrinsics and replace with ↵Craig Topper2011-10-215-51/+93
| | | | | | custom isel lowering code. llvm-svn: 142642
* Implement a block placement pass based on the branch probability andChandler Carruth2011-10-216-2/+643
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | block frequency analyses. This differs substantially from the existing block-placement pass in LLVM: 1) It operates on the Machine-IR in the CodeGen layer. This exposes much more (and more precise) information and opportunities. Also, the results are more stable due to fewer transforms ocurring after the pass runs. 2) It uses the generalized probability and frequency analyses. These can model static heuristics, code annotation derived heuristics as well as eventual profile loading. By basing the optimization on the analysis interface it can work from any (or a combination) of these inputs. 3) It uses a more aggressive algorithm, both building chains from tho bottom up to maximize benefit, and using an SCC-based walk to layout chains of blocks in a profitable ordering without O(N^2) iterations which the old pass involves. The pass is currently gated behind a flag, and not enabled by default because it still needs to grow some important features. Most notably, it needs to support loop aligning and careful layout of loop structures much as done by hand currently in CodePlacementOpt. Once it supports these, and has sufficient testing and quality tuning, it should replace both of these passes. Thanks to Nick Lewycky and Richard Smith for help authoring & debugging this, and to Jakob, Andy, Eric, Jim, and probably a few others I'm forgetting for reviewing and answering all my questions. Writing a backend pass is *sooo* much better now than it used to be. =D llvm-svn: 142641
* Check for divide by zero.Bill Wendling2011-10-211-2/+2
| | | | llvm-svn: 142640
* Remove a now dead function, fixing -Wunused-function warnings fromChandler Carruth2011-10-211-20/+0
| | | | | | Clang. llvm-svn: 142631
* Fix unused variable warning.Richard Smith2011-10-211-1/+1
| | | | llvm-svn: 142630
* Revert r142618, r142622, and r142624, which were based on an incorrect ↵Owen Anderson2011-10-204-65/+77
| | | | | | reading of the ARMv7 docs. llvm-svn: 142626
* Fix decoding tests for fixed MSR encodings.Owen Anderson2011-10-202-55/+5
| | | | llvm-svn: 142624
OpenPOWER on IntegriCloud