summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopUnrollPass.cpp
Commit message (Collapse)AuthorAge
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the Function::getFnAttributes method in favor of using the AttributeSetBill Wendling2012-12-30
| | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171253 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a new attribute, 'noduplicate'. If a function contains a noduplicate ↵James Molloy2012-12-20
| | | | | | | | | | call, the call cannot be duplicated - Jump threading, loop unrolling, loop unswitching, and loop rotation are inhibited if they would duplicate the call. Similarly inlining of the function is inhibited, if that would duplicate the call (in particular inlining is still allowed when there is only one callsite and the function has internal linkage). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170704 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the 'Attributes' class to 'Attribute'. It's going to represent a ↵Bill Wendling2012-12-19
| | | | | | single attribute in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | 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. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Create enums for the different attributes.Bill Wendling2012-10-09
| | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165488 91177308-0d34-0410-b5e6-96231b3b80d8
* Move TargetData to DataLayout.Micah Villmow2012-10-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the `hasFnAttr' method from Function.Bill Wendling2012-09-26
| | | | | | | | The hasFnAttr method has been replaced by querying the Attributes explicitly. No intended functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164725 91177308-0d34-0410-b5e6-96231b3b80d8
* LoopUnrollPass: Use variable "Threshold" instead of "CurrentThreshold" whenHongbin Zheng2012-04-04
| | | | | | | reducing unroll count, otherwise the reduced unroll count is not taking the "OptimizeForSize" attribute into account. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154007 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -unroll-runtime for unrolling loops with run-time trip counts.Andrew Trick2011-12-09
| | | | | | | | | | | | | | Patch by Brendon Cahoon! This extends the existing LoopUnroll and LoopUnrollPass. Brendon measured no regressions in the llvm test suite with -unroll-runtime enabled. This implementation works by using the existing loop unrolling code to unroll the loop by a power-of-two (default 8). It generates an if-then-else sequence of code prior to the loop to execute the extra iterations before entering the unrolled loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146245 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the temporary flag -disable-unroll-scev and dead code.Andrew Trick2011-11-28
| | | | | | | SCEV should now be used for trip count analysis, not LoopInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145262 91177308-0d34-0410-b5e6-96231b3b80d8
* Initialze ScalarEvalution dependency.Devang Patel2011-10-19
| | | | | | | Patch by Pranav Bhandarkar! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142556 91177308-0d34-0410-b5e6-96231b3b80d8
* Inlining and unrolling heuristics should be aware of free truncs.Andrew Trick2011-10-01
| | | | | | | | | | | We want heuristics to be based on accurate data, but more importantly we don't want llvm to behave randomly. A benign trunc inserted by an upstream pass should not cause a wild swings in optimization level. See PR11034. It's a general problem with threshold-based heuristics, but we can make it less bad. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140919 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable SCEV-based unrolling by default.Andrew Trick2011-09-02
| | | | | | | | | | | | | | | | | | | | | This changes loop unrolling to use the same mechanism for trip count computation as indvars. This is a stronger check that tends to unroll more loops. A very common side-effect is that many single iteration loops will be removed sooner. The real goal was simply to remove dependence on canonical IVs. x86 is break even. ARM performance changes to expect (+ is good): External/SPEC/CFP2000/183.equake/183.equake +13% SingleSource/Benchmarks/Dhrystone/fldry +21% MultiSource/Applications/spiff/spiff +3% SingleSource/Benchmarks/Stanford/Puzzle -14% The Puzzle regression is actually an improvement in loop optimization that defeats GVN: rdar://problem/10065079. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139009 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow loop unrolling to get known trip counts from ScalarEvolution.Andrew Trick2011-08-11
| | | | | | | | | | | | | | SCEV unrolling can unroll loops with arbitrary induction variables. It is a prerequisite for -disable-iv-rewrite performance. It is also easily handles loops of arbitrary structure including multiple exits and is generally more robust. This is under a temporary option to avoid affecting default behavior for the next couple of weeks. It is needed so that I can checkin unit tests for updateUnloop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137384 91177308-0d34-0410-b5e6-96231b3b80d8
* Invoke SimplifyIndVar when we partially unroll a loop. Fixes PR10534.Andrew Trick2011-08-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137203 91177308-0d34-0410-b5e6-96231b3b80d8
* Move trip count discovery outside of the generic LoopUnroll helper. ThisAndrew Trick2011-07-23
| | | | | | | removes its dependence on canonical induction variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135829 91177308-0d34-0410-b5e6-96231b3b80d8
* whitespaceAndrew Trick2011-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135828 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a couple -Wsign-compare warnings.Chris Lattner2011-04-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129501 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed the revision 129449.Junjie Gu2011-04-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129450 91177308-0d34-0410-b5e6-96231b3b80d8
* Passing unroll parameters (unroll-count, threshold, and partial unroll) via ↵Junjie Gu2011-04-13
| | | | | | | | | | | LoopUnroll class's ctor. Doing so will allow multiple context with different loop unroll parameters to run. This is a minor change and no effect on existing application. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129449 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove dead code, that I apparently wrote a while back. We seem to be doing ↵Owen Anderson2011-01-17
| | | | | | | | | | | well enough without whatever this was trying to do. When/if someone has the time to do some empirical evaluations, it might be worth it to figure out what this code was trying to do and see if it's worth resurrecting/fixing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123684 91177308-0d34-0410-b5e6-96231b3b80d8
* random cleanupsChris Lattner2011-01-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123221 91177308-0d34-0410-b5e6-96231b3b80d8
* improve loop rotation to use CodeMetrics to analyze theChris Lattner2011-01-02
| | | | | | | | size of a loop header instead of its own code size estimator. This allows it to handle bitcasts etc more precisely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122681 91177308-0d34-0410-b5e6-96231b3b80d8
* Passes do not need to recursively initialize passes that they preserve, ifOwen Anderson2010-10-19
| | | | | | | | they do not also require them. This allows us to reduce inter-pass linkage dependencies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116854 91177308-0d34-0410-b5e6-96231b3b80d8
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-19
| | | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116820 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-12
| | | | | | | | | | perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116334 91177308-0d34-0410-b5e6-96231b3b80d8
* Now with fewer extraneous semicolons!Owen Anderson2010-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r114919, which caused some serious regressions on ARM.Owen Anderson2010-09-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115053 91177308-0d34-0410-b5e6-96231b3b80d8
* Weight loop unrolling counts by nesting depth. Unrolling deeply nested loops ↵Owen Anderson2010-09-27
| | | | | | | | | | | | tends to cause high register pressure and thus excess spills, which we don't currently recover from well. This should be re-evaluated in the future if our ability to generate good spills/splits improves. Partial fix for <rdar://problem/7635585>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114919 91177308-0d34-0410-b5e6-96231b3b80d8
* Lower the unrolling theshold to 150. Empirical tests indicate that this is ↵Owen Anderson2010-09-10
| | | | | | | | | a sweet spot in the performance per code size increase curve. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113595 91177308-0d34-0410-b5e6-96231b3b80d8
* What the loop unroller cares about, rather than just not unrolling loops ↵Owen Anderson2010-09-09
| | | | | | | | | | | | with calls, is not unrolling loops that contain calls that would be better off getting inlined. This mostly comes up when an interleaved devirtualization pass has devirtualized a call which the inliner will inline on a future pass. Thus, rather than blocking all loops containing calls, add a metric for "inline candidate calls" and block loops containing those instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113535 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r113439, which relaxed the requirement that loops containing calls ↵Owen Anderson2010-09-09
| | | | | | | | | cannot be unrolled. After some discussion, there seems to be a better way to achieve the same effect. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113528 91177308-0d34-0410-b5e6-96231b3b80d8
* r113526 introduced an unintended change to the loop unrolling threshold. ↵Owen Anderson2010-09-09
| | | | | | Revert it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113527 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo in code to cap the loop code size reduction calculation.Owen Anderson2010-09-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113526 91177308-0d34-0410-b5e6-96231b3b80d8
* Use code-size reduction metrics to estimate the amount of savings we'll get ↵Owen Anderson2010-09-09
| | | | | | | | | when we unroll a loop. Next step is to recalculate the threshold values given this new heuristic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113525 91177308-0d34-0410-b5e6-96231b3b80d8
* Relax the "don't unroll loops containing calls" rule. Instead, when a loop ↵Owen Anderson2010-09-08
| | | | | | | | | | contains a call, lower the unrolling threshold to the optimize-for-size threshold. Basically, for loops containing calls, unrolling can still be profitable as long as the loop is REALLY small. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113439 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a separate unrolling threshold when the current function is being ↵Owen Anderson2010-09-07
| | | | | | | | | | | optimized for size. The threshold value of 50 is arbitrary, and I chose it simply by analogy to the inlining thresholds, where the baseline unrolling threshold is slightly smaller than the baseline inlining threshold. This could undoubtedly use some tuning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113306 91177308-0d34-0410-b5e6-96231b3b80d8
* now that loop passes don't use DomFrontier, there is no reasonChris Lattner2010-08-29
| | | | | | | | for the unroller to pretend it supports updating it. It still has a horrible hack for DomTree. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112444 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r110396 to fix buildbots.Owen Anderson2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-05
| | | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
* Experiments show that we can safely increase our unrolling threshold without ↵Owen Anderson2010-08-04
| | | | | | | | | unduly impacting code size, particularly since unrolling is not enabled at -Os. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110233 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove LCSSA's bogus dependence on LoopSimplify and LoopSimplify's bogusDan Gohman2010-07-26
| | | | | | | | | | | | | | | dependence on DominanceFrontier. Instead, add an explicit DominanceFrontier pass in StandardPasses.h to ensure that it gets scheduled at the right time. Declare that loop unrolling preserves ScalarEvolution, and shuffle some getAnalysisUsages. This eliminates one LoopSimplify and one LCCSA run in the standard compile opts sequence. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109413 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a DominatorTree argument to isLCSSA so that it doesn't have toDan Gohman2010-03-10
| | | | | | | | compute a set of reachable blocks for itself each time it is called, which is fairly frequently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98179 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't unroll loops containing function calls.Jakob Stoklund Olesen2010-02-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95454 91177308-0d34-0410-b5e6-96231b3b80d8
* Change errs() to dbgs().David Greene2010-01-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92623 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace LoopUnrollPass.cpp's custom code-size estimation code usingDan Gohman2009-10-31
| | | | | | | the new common CodeMetrics code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85663 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unnecessary #include.Dan Gohman2009-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85661 91177308-0d34-0410-b5e6-96231b3b80d8