summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* SimplifyCFG: sink common codes from IF, ELSE blocks down to END block.Manman Ren2012-09-201-0/+173
| | | | | | | | | | | | We already have HoistThenElseCodeToIf, this patch implements SinkThenElseCodeToEnd. When END block has only two predecessors and each predecessor terminates with unconditional branches, we compare instructions in IF and ELSE blocks backwards and check whether we can sink the common instructions down. rdar://12191395 llvm-svn: 164325
* Renaming functions to match coding style guidelinesMichael Ilseman2012-09-191-4/+4
| | | | llvm-svn: 164238
* Doxygen-ify commentsMichael Ilseman2012-09-191-8/+16
| | | | llvm-svn: 164235
* Put the * and & next to the variable, rather than the type.Michael Ilseman2012-09-191-73/+73
| | | | llvm-svn: 164232
* SimplifyCFG: Don't generate invalid code for switch used to initializeHans Wennborg2012-09-191-9/+8
| | | | | | | | | | | | | two variables where the first variable is returned and the second ignored. I don't think this occurs in practice (other passes should have cleaned up the unused phi node), but it should still be handled correctly. Also make the logic for determining if we should return early less sketchy. llvm-svn: 164225
* IntegerDivision: Style cleanups, avoid warning about mixing || and && ↵Benjamin Kramer2012-09-191-7/+5
| | | | | | without parens. llvm-svn: 164216
* CodeGenPrep: turn lookup tables into switches for some targets.Hans Wennborg2012-09-191-4/+114
| | | | | | | | | | | | | | | | | | | This is a follow-up from r163302, which added a transformation to SimplifyCFG that turns some switches into loads from lookup tables. It was pointed out that some targets, such as GPUs and deeply embedded targets, might not find this appropriate, but SimplifyCFG doesn't have enough information about the target to decide this. This patch adds the reverse transformation to CodeGenPrep: it turns loads from lookup tables back into switches for targets where we do not build jump tables (assuming these are also the targets where lookup tables are inappropriate). Hopefully we will eventually get to have target information in SimplifyCFG, and then this CodeGenPrep transformation can be removed. llvm-svn: 164206
* Fix the last crasher I've gotten a reproduction for in SROA. This oneChandler Carruth2012-09-181-0/+2
| | | | | | | | | | | from the dragonegg build bots when we turned on the full version of the pass. Included a much reduced test case for this pesky bug, despite bugpoint's uncooperative behavior. Also, I audited all the similar code I could find and didn't spot any other cases where this mistake cropped up. llvm-svn: 164178
* New utility for expanding integer division for targets that don't support it.Michael Ilseman2012-09-182-0/+307
| | | | | | Implementation derived from compiler-rt's implementation of signed and unsigned integer division. llvm-svn: 164173
* LSR critical edge splitting fix for PR13756.Andrew Trick2012-09-181-11/+15
| | | | llvm-svn: 164147
* Fix getCommonType in a different way from the way I fixed it whenChandler Carruth2012-09-181-1/+1
| | | | | | | | | | | | working on FCA splitting. Instead of refusing to form a common type when there are uses of a subsection of the alloca as well as a use of the entire alloca, just skip the subsection uses and continue looking for a whole-alloca use with a type that we can use. This produces slightly prettier IR I think, and also fixes the other failure in the test. llvm-svn: 164146
* Fix build for compilers that don't understand injected class names properly.Benjamin Kramer2012-09-181-2/+2
| | | | llvm-svn: 164142
* SROA: Use CRTP for OpSplitter to get rid of virtual dispatch and the ↵Benjamin Kramer2012-09-181-8/+7
| | | | | | virtual-dtor warnings that come with it. llvm-svn: 164140
* SROA: Replace the member function template contraption for recursively ↵Benjamin Kramer2012-09-181-97/+105
| | | | | | | | splitting aggregates into a real class. No intended functionality change. llvm-svn: 164135
* SROA.cpp: Appease msvc.NAKAMURA Takumi2012-09-181-1/+1
| | | | | | ...I don't know why this could appease msvc...baad. llvm-svn: 164130
* LNT builders have picked up new SROA, disable it to get the remaining ↵Benjamin Kramer2012-09-181-1/+1
| | | | | | builders green again. llvm-svn: 164124
* Fix a warning in release builds and a test case I forgot to update withChandler Carruth2012-09-181-0/+1
| | | | | | a fix to getCommonType in the previous patch. llvm-svn: 164120
* Add a major missing piece to the new SROA pass: aggressive splitting ofChandler Carruth2012-09-182-8/+221
| | | | | | | | | | | | | | | | | | | | | | | FCAs. This is essential in order to promote allocas that are used in struct returns by frontends like Clang. The FCA load would block the rest of the pass from firing, resulting is significant regressions with the bullet benchmark in the nightly test suite. Thanks to Duncan for repeated discussions about how best to do this, and to both him and Benjamin for review. This appears to have blocked many places where the pass tries to fire, and so I'm expect somewhat different results with this fix added. As with the last big patch, I'm including a change to enable the SROA by default *temporarily*. Ben is going to remove this as soon as the LNT bots pick up the patch. I'm just trying to get a round of LNT numbers from the stable machines in the lab. NOTE: Four clang tests are expected to fail in the brief window where this is enabled. Sorry for the noise! llvm-svn: 164119
* Fix instcombine to obey requested alignment when merging allocas.Richard Osborne2012-09-181-3/+7
| | | | llvm-svn: 164117
* Mark unimplemented copy constructors and copy assignment operators as ↵Craig Topper2012-09-181-3/+2
| | | | | | LLVM_DELETED_FUNCTION. llvm-svn: 164090
* PGO: preserve branch-weight metadata when simplifying Switch to a sub, an icmpManman Ren2012-09-181-1/+38
| | | | | | and a conditional branch; also when removing dead cases from a switch. llvm-svn: 164084
* PGO: preserve branch-weight metadata when simplifying SwitchManman Ren2012-09-171-0/+15
| | | | | | | Hanlde the case when we split the default edge if the default target has "icmp" and unconditinal branch. llvm-svn: 164076
* PGO: preserve branch-weight metadata when simplifying SwitchOnSelect.Manman Ren2012-09-171-5/+28
| | | | llvm-svn: 164068
* PGO: preserve branch-weight metadata when simplifying two branches with a commonManman Ren2012-09-171-0/+27
| | | | | | destination in SimplifyCondBranchToCondBranch. llvm-svn: 164054
* s/__llvm_gcov_flush/__gcov_flush/gBill Wendling2012-09-171-4/+4
| | | | llvm-svn: 164040
* NewSROA: Provide a full set of operator< for ByteRanges.Benjamin Kramer2012-09-171-2/+7
| | | | | | MSVC8 won't compile lower_bound if one is missing. llvm-svn: 164035
* Fix a few vars that can end up being used without initialization.Axel Naumann2012-09-172-2/+2
| | | | | | The cases where no initialization happens should still be checked for logic flaws. llvm-svn: 164032
* Refactor the SROA visitors for partitioning an alloca and buildingChandler Carruth2012-09-161-24/+29
| | | | | | | | | | | | | | | | | | | | | partition use lists a bit. No functionality changed. These visitors are actually visiting a tuple of a Use and an offset into the alloca. However, we use the InstVisitor to handle the dispatch over the users, and so the Use and Offset are stored in class member variables and set just before each call to visit(). This is fairly awkward and makes the functions a bit harder to read, but its the only real option we have until InstVisitor can be rewritten to use variadic templates. However, this pattern shouldn't be followed on the helper member functions where there is no interface constraint from the visitor. We already were passing the instruction as a normal parameter rather than use the Use to get at it, start passing the offset as well. This will become more important in subsequent patches as the offset will in some cases change while visiting a single instruction. llvm-svn: 164003
* Use LLVM_DELETED_FUNCTION in place of 'DO NOT IMPLEMENT' comments.Craig Topper2012-09-152-4/+6
| | | | llvm-svn: 163974
* Disable new sroa now that all buildbots have tested it.Benjamin Kramer2012-09-151-1/+1
| | | | | | | | | | | | | | | | | What we have so far: - Some clang test failures (these were known already) - Perf results are mixed, some big regressions http://llvm.org/perf/db_default/v4/nts/3844 http://llvm.org/perf/db_default/v4/nts/3845 bullet suffers a lot. matmul is interesting: slower scalar code, faster with -vectorize. - Some dragonegg selfhost bots crash in SROA during selfhost now http://lab.llvm.org:8011/builders/dragonegg-x86_64-linux-gcc-4.6-self-host-checks/builds/1632 http://lab.llvm.org:8011/builders/dragonegg-x86_64-linux-gcc-4.5-self-host/builds/1891 llvm-svn: 163968
* Port the SSAUpdater-based promotion logic from the old SROA pass to theChandler Carruth2012-09-152-14/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new one, and add support for running the new pass in that mode and in that slot of the pass manager. With this the new pass can completely replace the old one within the pipeline. The strategy for enabling or disabling the SSAUpdater logic is to do it by making the requirement of the domtree analysis optional. By default, it is required and we get the standard mem2reg approach. This is usually the desired strategy when run in stand-alone situations. Within the CGSCC pass manager, we disable requiring of the domtree analysis and consequentially trigger fallback to the SSAUpdater promotion. In theory this would allow the pass to re-use a domtree if one happened to be available even when run in a mode that doesn't require it. In practice, it lets us have a single pass rather than two which was simpler for me to wrap my head around. There is a hidden flag to force the use of the SSAUpdater code path for the purpose of testing. The primary testing strategy is just to run the existing tests through that path. One notable difference is that it has custom code to handle lifetime markers, and one of the tests has been enhanced to exercise that code. This has survived a bootstrap and the test suite without serious correctness issues, however my run of the test suite produced *very* alarming performance numbers. I don't entirely understand or trust them though, so more investigation is on-going. To aid my understanding of the performance impact of the new SROA now that it runs throughout the optimization pipeline, I'm enabling it by default in this commit, and will disable it again once the LNT bots have picked up one iteration with it. I want to get those bots (which are much more stable) to evaluate the impact of the change before I jump to any conclusions. NOTE: Several Clang tests will fail because they run -O3 and check the result's order of output. They'll go back to passing once I disable it again. llvm-svn: 163965
* PGO: preserve branch-weight metadata when simplifying two branches with a commonManman Ren2012-09-151-111/+42
| | | | | | | | | | | | | | | | destination. Updated previous implementation to fix a case not covered: // PBI: br i1 %x, TrueDest, BB // BI: br i1 %y, TrueDest, FalseDest The other case was handled correctly. // PBI: br i1 %x, BB, FalseDest // BI: br i1 %y, TrueDest, FalseDest Also tried to use 64-bit arithmetic instead of APInt with scale to simplify the computation. Let me know if you have other opinions about this. llvm-svn: 163954
* Remove comment.Bill Wendling2012-09-141-1/+1
| | | | llvm-svn: 163945
* PGO: preserve branch-weight metadata when simplifying a switch with a singleManman Ren2012-09-142-2/+33
| | | | | | case to a conditional branch and when removing dead cases. llvm-svn: 163942
* Stylistic and 80-col fixesEvan Cheng2012-09-142-8/+4
| | | | llvm-svn: 163940
* Review feedback from Duncan Sands. Alphabetize includes and simplifyAlex Rosenberg2012-09-141-3/+3
| | | | | | lit config. llvm-svn: 163928
* Try to fix the bots by detecting inconsistant branch-weight metadata.Manman Ren2012-09-141-4/+10
| | | | llvm-svn: 163926
* PGO: preserve branch-weight metadata when merging two switches whereManman Ren2012-09-141-5/+12
| | | | | | | the default target of the first switch is not the basic block the second switch is in (PredDefault != BB). llvm-svn: 163916
* Fix Doxygen issues:Dmitri Gribenko2012-09-141-4/+4
| | | | | | | | | | * wrap code blocks in \code ... \endcode; * refer to parameter names in paragraphs correctly (\arg is not what most people want -- it starts a new paragraph); * use \param instead of \arg to document parameters in order to be consistent with the rest of the codebase. llvm-svn: 163902
* SROA: Silence unused variable warnings in Release builds.Benjamin Kramer2012-09-141-1/+8
| | | | | | The NDEBUG hack is ugly, but I see no better solution. llvm-svn: 163900
* Rework the computation of a sub-structure natural type. There wereChandler Carruth2012-09-141-10/+20
| | | | | | | | | | | | | pointless checks in here, bad asserts, and just confusing code. I've also added a bit more to the comment to clarify what this function is really trying to do as it was not obvious to Duncan when studying it. Thanks to Duncan for helping me dig through the issue. No real functionality changed here in practical cases, and certainly no test case. This is just cleanup spotted by inspection. llvm-svn: 163897
* Rely on the recursive check for pointer types rather than adding anChandler Carruth2012-09-141-3/+0
| | | | | | | explicit check before recursing. A simplification requested by Duncan during review. llvm-svn: 163896
* Be a bit more aggressive in bailing out of this routine. Spotted byChandler Carruth2012-09-141-1/+1
| | | | | | | inspection by Duncan during review. My suspicion is that we would still have returned 0 anyways in this case, but doing it sooner is better. llvm-svn: 163895
* Add some comments clarifying that the GEP analysis for vector GEPs isChandler Carruth2012-09-141-1/+4
| | | | | | | | deeply suspicious and likely to go away eventually. Also fix a bogus comment about one of the checks in the vector GEP analysis. Based on review from Duncan. llvm-svn: 163894
* Move an instance variable to a local variable based on review by Duncan.Chandler Carruth2012-09-141-9/+16
| | | | | | | | Originally I had anticipated needing to thread this through more bits of the SROA pass itself, but that ended up not happening. In the end, this is a much simpler way to manange the variable. llvm-svn: 163893
* Add a comment about debug intrinsics that I *really* don't want toChandler Carruth2012-09-141-0/+2
| | | | | | forget from Duncan's review as a FIXME. llvm-svn: 163892
* Add two asserts that Duncan thought would help ensure things don't rotChandler Carruth2012-09-141-0/+2
| | | | | | unexpectedly in the future. More fixes from his code review. llvm-svn: 163891
* Actually keep the flag default-off for now. =/ That's what I get forChandler Carruth2012-09-141-1/+1
| | | | | | being busy testing this... llvm-svn: 163890
* Remove some dead, commented out code Duncan spotted in review.Chandler Carruth2012-09-141-4/+0
| | | | llvm-svn: 163889
* Wrap the dumping and printing routines in NDEBUG and LLVM_ENABLE_DUMP macros.Chandler Carruth2012-09-141-0/+6
| | | | llvm-svn: 163888
OpenPOWER on IntegriCloud