summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* Minor cleanups. No functionality change.Jakub Staszak2013-03-241-6/+7
| | | | llvm-svn: 177837
* Use dyn_cast instead of isa && cast.Jakub Staszak2013-03-241-8/+6
| | | | | | No functionality change. llvm-svn: 177836
* [SROA] Prefix names using a custom IRBuilder inserter.Chandler Carruth2013-03-211-88/+108
| | | | | | | | | | | | | | | | | | | The key part of this is ensuring that name prefixes remain in a Twine form until we get to a point where we can nuke them under NDEBUG. This is tricky using the old APIs as they played fast and loose with Twine, which is prone to serious error. The inserter is much cleaner as it is actually in the call stack leading to the setName call, and so has a good opportunity to prepend the prefix. This matters more than you might imagine because most runs over an alloca find a single partition, and rewrite 3 or 4 instructions referring to it. As a consequence doing this lazily and exclusively with Twine allows the optimizer to delete more of it and shaves another 2% to 3% off of the release build's SROA run time for PR15412. I also think the APIs are cleaner, and the use of Twine is more reliable, so I consider it a win-win despite the churn required to reach this state. llvm-svn: 177631
* simplify-libcalls: Removed unused variableMeador Inge2013-03-211-2/+0
| | | | | | | The 'Modified' variable should have been removed from SimplifyLibCalls in r177619, but was missed. This commit removes it. llvm-svn: 177622
* Move library call prototype attribute inference to functionattrsMeador Inge2013-03-211-701/+0
| | | | | | | | | | | | The simplify-libcalls pass implemented a doInitialization hook to infer function prototype attributes for well-known functions. Given that the simplify-libcalls pass is going away *and* that the functionattrs pass is already in place to deduce function attributes, I am moving this logic to the functionattrs pass. This approach was discussed during patch review: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20121126/157465.html. llvm-svn: 177619
* Fix a silly search-and-replace goof with r177495 that only brokeChandler Carruth2013-03-201-1/+1
| | | | | | non-release builds. llvm-svn: 177498
* [SROA] Don't preserve the IR names in release builds.Chandler Carruth2013-03-201-28/+37
| | | | | | | | | | | This is espcially important because the new SROA pass goes to great lengths to provide helpful names for debugging, and as a consequence they can become very slow to render. Good for between 5% and 15% of the SROA runtime on some slow test cases such as the one in PR15412. llvm-svn: 177495
* Move the endif to the correct line so we don't have warnings aboutChandler Carruth2013-03-201-1/+1
| | | | | | unused statistics variables. llvm-svn: 177494
* Introduce some new statistics to help track the exact behavior of theChandler Carruth2013-03-201-4/+20
| | | | | | new SROA pass. llvm-svn: 177493
* Update global merge pass according to Duncan's advices:Quentin Colombet2013-03-191-8/+7
| | | | | | | | - Remove useless includes - Change misleading comments - Move code into doFinalization llvm-svn: 177445
* IndVarSimplify: do not recompute an IV value outside of the loop if :Arnaud A. de Grandmaison2013-03-191-0/+39
| | | | | | | - it is trivially known to be used inside the loop in a way that can not be optimized away - there is no use outside of the loop which can take advantage of the computation hoisting llvm-svn: 177432
* Revert "Cleanup some SCEV logic a bit."Andrew Trick2013-03-191-4/+3
| | | | | | | | This reverts commit 82cd8f7382322bee7a71cdc31f7a923c44d37d32. Just add a comment instead! llvm-svn: 177377
* Cleanup some SCEV logic a bit.Andrew Trick2013-03-191-2/+4
| | | | | | Make the code more obvious to scan-build and humans. llvm-svn: 177375
* Tighten up an internal LSR API that should check for NULL.Andrew Trick2013-03-191-1/+1
| | | | | | No test case, but should fix a scan_build warning. llvm-svn: 177374
* Make method private. Keep coding standard.Jakub Staszak2013-03-181-26/+28
| | | | llvm-svn: 177348
* Extend global merge pass to optionally consider global constant variables.Quentin Colombet2013-03-181-5/+78
| | | | | | Also add some checks to not merge globals used within landing pad instructions or marked as "used". llvm-svn: 177331
* Mark internal classes as POD-like to get better behavior out ofChandler Carruth2013-03-181-102/+109
| | | | | | | | SmallVector and DenseMap. This speeds up SROA by 25% on PR15412. llvm-svn: 177259
* PR14972: SROA vs. GVN exposed a really bad bug in SROA.Chandler Carruth2013-03-141-117/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fundamental problem is that SROA didn't allow for overly wide loads where the bits past the end of the alloca were masked away and the load was sufficiently aligned to ensure there is no risk of page fault, or other trapping behavior. With such widened loads, SROA would delete the load entirely rather than clamping it to the size of the alloca in order to allow mem2reg to fire. This was exposed by a test case that neatly arranged for GVN to run first, widening certain loads, followed by an inline step, and then SROA which miscompiles the code. However, I see no reason why this hasn't been plaguing us in other contexts. It seems deeply broken. Diagnosing all of the above took all of 10 minutes of debugging. The really annoying aspect is that fixing this completely breaks the pass. ;] There was an implicit reliance on the fact that no loads or stores extended past the alloca once we decided to rewrite them in the final stage of SROA. This was used to encode information about whether the loads and stores had been split across multiple partitions of the original alloca. That required threading explicit tracking of whether a *use* of a partition is split across multiple partitions. Once that was done, another problem arose: we allowed splitting of integer loads and stores iff they were loads and stores to the entire alloca. This is a really arbitrary limitation, and splitting at least some integer loads and stores is crucial to maximize promotion opportunities. My first attempt was to start removing the restriction entirely, but currently that does Very Bad Things by causing *many* common alloca patterns to be fully decomposed into i8 operations and lots of or-ing together to produce larger integers on demand. The code bloat is terrifying. That is still the right end-goal, but substantial work must be done to either merge partitions or ensure that small i8 values are eagerly merged in some other pass. Sadly, figuring all this out took essentially all the time and effort here. So the end result is that we allow splitting only when the load or store at least covers the alloca. That ensures widened loads and stores don't hurt SROA, and that we don't rampantly decompose operations more than we have previously. All of this was already fairly well tested, and so I've just updated the tests to cover the wide load behavior. I can add a test that crafts the pass ordering magic which caused the original PR, but that seems really brittle and to provide little benefit. The fundamental problem is that widened loads should Just Work. llvm-svn: 177055
* Change the order of the operands in patchAndReplaceAllUsesWith soDan Gohman2013-03-121-5/+5
| | | | | | that they're more consistent with Value::replaceAllUsesWith. llvm-svn: 176872
* Keep coding stanard.Jakub Staszak2013-03-071-4/+3
| | | | llvm-svn: 176661
* Don't create IRBuilder if we can return from the method earlier.Jakub Staszak2013-03-071-2/+2
| | | | llvm-svn: 176660
* Bypass Slow DividesPreston Gurd2013-03-041-1/+1
| | | | | | | | | | | | | * Only apply divide bypass optimization when not optimizing for size. * Fixed bug caused by constant for 0 value of type Int32, used dividend type to generate the constant instead. * For atom x86-64 apply the divide bypass to use 16-bit divides instead of 64-bit divides when operand values are small enough. * Added lit tests for 64-bit divide bypass. Patch by Tyler Nowicki! llvm-svn: 176442
* CVP: If we have a PHI with an incoming select, try to skip the select.Benjamin Kramer2013-02-241-5/+24
| | | | | | | | | | This is a common pattern with dyn_cast and similar constructs, when the PHI no longer depends on the select it can often be turned into a simpler construct or even get hoisted out of the loop. PR15340. llvm-svn: 175995
* Implement the NoBuiltin attribute.Bill Wendling2013-02-221-1/+1
| | | | | | | | The 'nobuiltin' attribute is applied to call sites to indicate that LLVM should not treat the callee function as a built-in function. I.e., it shouldn't try to replace that function with different code. llvm-svn: 175835
* Remove dead code and whitespace.Chad Rosier2013-02-211-10/+0
| | | | llvm-svn: 175804
* Update a comment that looks to have been accidentally deleted many moons ago.Chad Rosier2013-02-201-1/+1
| | | | llvm-svn: 175658
* Remove unused variable.Jakub Staszak2013-02-191-2/+1
| | | | llvm-svn: 175568
* Minor cleanups. No functionality change.Jakub Staszak2013-02-191-10/+7
| | | | llvm-svn: 175567
* Remove unneeded #includes.Jakub Staszak2013-02-191-2/+0
| | | | llvm-svn: 175565
* Fix typos.Jakub Staszak2013-02-191-10/+10
| | | | llvm-svn: 175562
* Reduce indents in LSRInstance::NarrowSearchSpaceByCollapsingUnrolledCode method.Jakub Staszak2013-02-161-67/+67
| | | | | | No functionality change. llvm-svn: 175364
* Actually delete this code, since it's really not clear what it'sDan Gohman2013-02-121-24/+0
| | | | | | trying to do. llvm-svn: 175014
* Record PRE predecessors with a SmallVector instead of a DenseMap, andDan Gohman2013-02-121-8/+9
| | | | | | avoid a second pred_iterator traversal. llvm-svn: 175001
* When disabling PRE for a value is directly redundant with itselfDan Gohman2013-02-121-0/+2
| | | | | | | (through a loop), don't continue to iterate through the reamining predecessors. llvm-svn: 174994
* Check that pointers are removed from maps before calling delete on the pointers,Dan Gohman2013-02-121-3/+3
| | | | | | for tidiness' sake. llvm-svn: 174988
* Minor code simplification.Dan Gohman2013-02-121-1/+1
| | | | llvm-svn: 174985
* LSR IVChain improvement.Andrew Trick2013-02-091-1/+13
| | | | | | | | | Handle chains in which the same offset is used for both loads and stores to the same array. Fixes rdar://11410078. llvm-svn: 174789
* Remove #includes from the commonly used LoopInfo.h.Jakub Staszak2013-02-092-0/+2
| | | | llvm-svn: 174786
* This patch aims to improve compile time performance by increasingPreston Gurd2013-02-011-13/+13
| | | | | | | | | | | | | the SCEV vector size in LoopStrengthReduce. It is observed that the BaseRegs vector size is 4 in most cases, and elements are frequently copied when it is initialized as SmallVector<const SCEV *, 2> BaseRegs. Our benchmark results show that the compilation time performance improved by ~0.5%. Patch by Wan Xiaofei. llvm-svn: 174219
* Change GetPointerBaseWithConstantOffset's DataLayout argument from aDan Gohman2013-01-312-6/+6
| | | | | | | reference to a pointer, so that it can handle the case where DataLayout is not available and behave conservatively. llvm-svn: 174024
* Fixing warnings revealed by gcc release buildEdwin Vane2013-01-291-0/+1
| | | | | | | Fixed set-but-not-used warnings. Reviewer: gribozavr llvm-svn: 173810
* Extracted ObjCARC.cpp into its own library libLLVMObjCARCOpts in preparation ↵Michael Gottesman2013-01-283-4574/+0
| | | | | | for refactoring the ARC Optimizer. llvm-svn: 173647
* Renamed function IsPotentialUse to IsPotentialRetainableObjPtr.Michael Gottesman2013-01-271-18/+18
| | | | | | | | | This name change does the following: 1. Causes the function name to use proper ARC terminology. 2. Makes it clear what the function truly does. llvm-svn: 173609
* Added comment to ObjCARC elaborating what is meant by the term 'Provenance' ↵Michael Gottesman2013-01-241-0/+6
| | | | | | in 'Provenance Analysis'. llvm-svn: 173374
* Fixed typo.Michael Gottesman2013-01-221-2/+1
| | | | llvm-svn: 173202
* [ObjCARC] Refactored out the inner most 2-loops from PerformCodePlacement ↵Michael Gottesman2013-01-221-153/+198
| | | | | | | | | | | | | | | | into the method ConnectTDBUTraversals. The method PerformCodePlacement was doing too much (i.e. 3x loops, lots of different checking). This refactoring separates the analysis section of the method into a separate function while leaving the actual code placement and analysis preparation in PerformCodePlacement. *NOTE* Really this part of ObjCARC should be refactored out of the main pass class into its own seperate class/struct. But, it is not time to make that change yet though (don't want to make such an invasive change without fixing all of the bugs first). llvm-svn: 173201
* More encapsulation work.Bill Wendling2013-01-221-19/+19
| | | | | | | Use the AttributeSet when we're talking about more than one attribute. Add a function that adds a single attribute. No functionality change intended. llvm-svn: 173196
* Begin fleshing out an interface in TTI for modelling the costs ofChandler Carruth2013-01-221-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | generic function calls and intrinsics. This is somewhat overlapping with an existing intrinsic cost method, but that one seems targetted at vector intrinsics. I'll merge them or separate their names and use cases in a separate commit. This sinks the test of 'callIsSmall' down into TTI where targets can control it. The whole thing feels very hack-ish to me though. I've left a FIXME comment about the fundamental design problem this presents. It isn't yet clear to me what the users of this function *really* care about. I'll have to do more analysis to figure that out. Putting this here at least provides it access to proper analysis pass tools and other such. It also allows us to more cleanly implement the baseline cost interfaces in TTI. With this commit, it is now theoretically possible to simplify much of the inline cost analysis's handling of calls by calling through to this interface. That conversion will have to happen in subsequent commits as it requires more extensive restructuring of the inline cost analysis. The CodeMetrics class is now really only in the business of running over a block of code and aggregating the metrics on that block of code, with the actual cost evaluation done entirely in terms of TTI. llvm-svn: 173148
* Switch CodeMetrics itself over to use TTI to determine if an instructionChandler Carruth2013-01-213-9/+21
| | | | | | | | | | | | is free. The whole CodeMetrics API should probably be reworked more, but this is enough to allow deleting the duplicate code there for computing whether an instruction is free. All of the passes using this have been updated to pull in TTI and hand it to the CodeMetrics stuff. Further, a dead CodeMetrics API (analyzeFunction) is nuked for lack of users. llvm-svn: 173036
* Improved comment.Michael Gottesman2013-01-181-2/+5
| | | | llvm-svn: 172864
OpenPOWER on IntegriCloud