summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement proper ObjC ARC objc_retainBlock "escape" analysis, so thatDan Gohman2012-01-131-45/+63
| | | | | | | | the optimizer doesn't eliminate objc_retainBlock calls which are needed for their side effect of copying blocks onto the heap. This implements rdar://10361249. llvm-svn: 148076
* Re-fix the issue Bill fixed in r147899 in a slightly different way, which ↵Eli Friedman2012-01-111-5/+7
| | | | | | doesn't abuse the semantics of linker_private. We don't really want to merge any string constant with a weak_odr global. llvm-svn: 147971
* [asan] extend the workaround for http://llvm.org/bugs/show_bug.cgi?id=11395: ↵Kostya Serebryany2012-01-111-1/+1
| | | | | | don't instrument the function at all on x86_32 if it has a large asm blob llvm-svn: 147953
* Improved compile time:Stepan Dyatkovskiy2012-01-111-38/+98
| | | | | | | | | | | | 1. Size heuristics changed. Now we calculate number of unswitching branches only once per loop. 2. Some checks was moved from UnswitchIfProfitable to processCurrentLoop, since it is not changed during processCurrentLoop iteration. It allows decide to skip some loops at an early stage. Extended statistics: - Added total number of instructions analyzed. llvm-svn: 147935
* If the global variable is removed by the linker, then don't constant merge itBill Wendling2012-01-111-6/+10
| | | | | | | | | | | | | | with other symbols. An object in the __cfstring section is suppoed to be filled with CFString objects, which have a pointer to ___CFConstantStringClassReference followed by a pointer to a __cstring. If we allow the object in the __cstring section to be merged with another global, then it could end up in any section. Because the linker is going to remove these symbols in the final executable, we shouldn't bother to merge them. <rdar://problem/10564621> llvm-svn: 147899
* Enable LSR IV Chains with sufficient heuristics.Andrew Trick2012-01-101-5/+210
| | | | | | | | | | | | | | | | | | | | | | | | | These heuristics are sufficient for enabling IV chains by default. Performance analysis has been done for i386, x86_64, and thumbv7. The optimization is rarely important, but can significantly speed up certain cases by eliminating spill code within the loop. Unrolled loops are prime candidates for IV chains. In many cases, the final code could still be improved with more target specific optimization following LSR. The goal of this feature is for LSR to make the best choice of induction variables. Instruction selection may not completely take advantage of this feature yet. As a result, there could be cases of slight code size increase. Code size can be worse on x86 because it doesn't support postincrement addressing. In fact, when chains are formed, you may see redundant address plus stride addition in the addressing mode. GenerateIVChains tries to compensate for the common cases. On ARM, code size increase can be mitigated by using postincrement addressing, but downstream codegen currently misses some opportunities. llvm-svn: 147826
* Adding IV chain generation to LSR.Andrew Trick2012-01-091-5/+228
| | | | | | | | | | | | | | | | | | After collecting chains, check if any should be materialized. If so, hide the chained IV users from the LSR solver. LSR will only solve for the head of the chain. GenerateIVChains will then materialize the chained IV users by computing the IV relative to its previous value in the chain. In theory, chained IV users could be exposed to LSR's solver. This would be considerably complicated to implement and I'm not aware of a case where we need it. In practice it's more important to intelligently prune the search space of nontrivial loops before running the solver, otherwise the solver is often forced to prune the most optimal solutions. Hiding the chained users does this well, so that LSR is more likely to find the best IV for the chain as a whole. llvm-svn: 147801
* Adding collection of IV chains to LSR.Andrew Trick2012-01-091-0/+242
| | | | | | | | This collects a set of IV uses within the loop whose values can be computed relative to each other in a sequence. Following checkins will make use of this information. llvm-svn: 147797
* "Minor LSR debugging stuff"Andrew Trick2012-01-091-1/+4
| | | | llvm-svn: 147785
* Move assert to the right place.Benjamin Kramer2012-01-091-1/+1
| | | | llvm-svn: 147779
* InstCombine: Teach foldLogOpOfMaskedICmpsHelper that sign bit tests are bit ↵Benjamin Kramer2012-01-091-81/+82
| | | | | | | | tests. This subsumes several other transforms while enabling us to catch more cases. llvm-svn: 147777
* Tweak my last commit to be less conservative about uses.Benjamin Kramer2012-01-081-25/+23
| | | | | | | We still save an instruction when just the "and" part is replaced. Also change the code to match comments more closely. llvm-svn: 147753
* InstCombine: If we have a bit test and a sign test anded/ored together, ↵Benjamin Kramer2012-01-081-0/+32
| | | | | | | | merge the sign bit into the bit test. This is common in bit field code, e.g. checking if the first or the last bit of a bit field is set. llvm-svn: 147749
* Enable redundant phi elimination after LSR.Andrew Trick2012-01-071-1/+3
| | | | | | This will be more important as we extend the LSR pass in ways that don't rely on the formula solver. In particular, we need it for constructing IV chains. llvm-svn: 147724
* LSR: Don't optimize loops if an outer loop has no preheader.Andrew Trick2012-01-071-1/+8
| | | | | | | | LoopSimplify may not run on some outer loops, e.g. because of indirect branches. SCEVExpander simply cannot handle outer loops with no preheaders. Fixes rdar://10655343 SCEVExpander segfault. llvm-svn: 147718
* LSR: run DeleteDeadPhis before replaceCongruentPhis.Andrew Trick2012-01-071-19/+15
| | | | llvm-svn: 147711
* Extended replaceCongruentPhis to handle mixed phi types.Andrew Trick2012-01-071-2/+2
| | | | llvm-svn: 147707
* [asan] cleanup: remove the SIGILL-related code (compiler part)Kostya Serebryany2012-01-061-68/+8
| | | | llvm-svn: 147667
* Fix SpeculativelyExecuteBB to either speculate all or none of the phisDan Gohman2012-01-051-140/+148
| | | | | | | | | | | | present in the bottom of the CFG triangle, as the transformation isn't ever valuable if the branch can't be eliminated. Also, unify some heuristics between SimplifyCFG's multiple if-converters, for consistency. This fixes rdar://10627242. llvm-svn: 147630
* PR11705, part 2: globalopt shouldn't put inttoptr/ptrtoint operations into ↵Eli Friedman2012-01-051-10/+20
| | | | | | global initializers if there's an implied extension or truncation. llvm-svn: 147625
* Revert r56315. When the instruction to speculate is a load, thisDan Gohman2012-01-051-26/+2
| | | | | | | | code can incorrectly move the load across a store. This never happens in practice today, but only because the current heuristics accidentally preclude it. llvm-svn: 147623
* SCCCaptured is trivially false on entry to this loop and not modified inside it.Nick Lewycky2012-01-051-1/+1
| | | | | | Eliminate the dead test for it on each loop iteration. No functionality change. llvm-svn: 147616
* Remove pointless asserts.Nick Lewycky2012-01-041-2/+0
| | | | llvm-svn: 147529
* Teach instcombine all sorts of great stuff about shifts that have exact, nuw orNick Lewycky2012-01-042-8/+59
| | | | | | nsw bits on them. llvm-svn: 147528
* Make use of the exact bit when optimizing '(X >>exact 3) << 1' to eliminate theNick Lewycky2011-12-311-5/+11
| | | | | | | 'and' that would zero out the trailing bits, and to produce an exact shift ourselves. llvm-svn: 147391
* Change CaptureTracking to pass a Use* instead of a Value* when a value isNick Lewycky2011-12-281-5/+222
| | | | | | | | | | | | | | captured. This allows the tracker to look at the specific use, which may be especially interesting for function calls. Use this to fix 'nocapture' deduction in FunctionAttrs. The existing one does not iterate until a fixpoint and does not guarantee that it produces the same result regardless of iteration order. The new implementation builds up a graph of how arguments are passed from function to function, and uses a bottom-up walk on the argument-SCCs to assign nocapture. This gets us nocapture more often, and does so rather efficiently and independent of iteration order. llvm-svn: 147327
* Demystify this comment.Nick Lewycky2011-12-281-5/+16
| | | | llvm-svn: 147307
* Use false not zero, as a bool.Nick Lewycky2011-12-271-2/+2
| | | | llvm-svn: 147292
* Turn cos(-x) into cos(x). Patch by Alexander Malyshev!Nick Lewycky2011-12-271-5/+27
| | | | llvm-svn: 147291
* Teach simplifycfg to recompute branch weights when merging some branches, andNick Lewycky2011-12-271-0/+67
| | | | | | | to discard weights when appropriate. Still more to do (and a new TODO), but it's a start! llvm-svn: 147286
* Fix warning.Rafael Espindola2011-12-261-1/+2
| | | | llvm-svn: 147284
* Update the branch weight metadata when reversing the order of a branch.Nick Lewycky2011-12-261-4/+1
| | | | llvm-svn: 147280
* Sort includes, canonicalize whitespace, fix typos. No functionality change.Nick Lewycky2011-12-261-12/+12
| | | | llvm-svn: 147279
* InstCombine: Add a combine that turns (2^n)-1 ^ x back into (2^n)-1 - x iff ↵Benjamin Kramer2011-12-241-0/+13
| | | | | | | | | x is smaller than 2^n and it fuses with a following add. This was intended to undo the sub canonicalization in cases where it's not profitable, but it also finds some cases on it's own. llvm-svn: 147256
* InstCombine: Canonicalize (2^n)-1 - x into (2^n)-1 ^ x iff x is known to be ↵Benjamin Kramer2011-12-242-0/+14
| | | | | | | | | | | smaller than 2^n. This has the obvious advantage of being commutable and is always a win on x86 because const - x wastes a register there. On less weird architectures this may lead to a regression because other arithmetic doesn't fuse with it anymore. I'll address that problem in a followup. llvm-svn: 147254
* Fix typo "infinte".Nick Lewycky2011-12-231-1/+2
| | | | llvm-svn: 147226
* When not destroying the source, the linker is not remapping the types. Added ↵Mon P Wang2011-12-231-2/+4
| | | | | | | | support to CloneFunctionInto to allow remapping for this case. llvm-svn: 147217
* Add the actual code for r147175.Chad Rosier2011-12-221-11/+82
| | | | llvm-svn: 147176
* Speculatively revert r146578 to determine if it is the cause of a number ofChad Rosier2011-12-221-82/+11
| | | | | | | | | | | performance regressions (both execution-time and compile-time) on our nightly testers. Original commit message: Fix for bug #11429: Wrong behaviour for switches. Small improvement for code size heuristics. llvm-svn: 147131
* Fix a copy+pasto. No testcase, because the symptoms of dereferencingDan Gohman2011-12-211-1/+1
| | | | | | an invalid iterator aren't reproducible. rdar://10614085. llvm-svn: 147098
* Make some intrinsics safe to speculatively execute.Nick Lewycky2011-12-211-0/+1
| | | | llvm-svn: 147036
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146960
* - Use getExitingBlock instead of getExitingBlocks.Jakub Staszak2011-12-181-13/+11
| | | | | | - Remove trailing spaces. llvm-svn: 146854
* Revert r146822 at Pete Cooper's request as it broke clang self hosting.Kevin Enderby2011-12-171-42/+0
| | | | | | Hope I did this correctly :) llvm-svn: 146834
* SimplifyCFG now predicts some conditional branches to true or false ↵Pete Cooper2011-12-171-0/+42
| | | | | | | | | | | | | depending on previous branch on same comparison operands. For example, if (a == b) { if (a > b) // this is false Fixes some of the issues on <rdar://problem/10554090> llvm-svn: 146822
* Refactor code used in InstCombine::FoldAndOfICmps to new file.Pete Cooper2011-12-173-72/+109
| | | | | | This will be used by SimplifyCfg in a later commit. llvm-svn: 146803
* The powers that be have decided that LLVM IR should now support 16-bitDan Gohman2011-12-172-1/+6
| | | | | | | | "half precision" floating-point with a first-class type. This patch adds basic IR support (but not codegen support). llvm-svn: 146786
* Avoid a confusing assert for silly options: -unroll-runtime -unroll-count=1.Andrew Trick2011-12-161-0/+5
| | | | | | No need for an explicit test case for an unsupported combination of options. llvm-svn: 146721
* [asan] add the name of the module to the description of a global variable. ↵Kostya Serebryany2011-12-151-1/+5
| | | | | | This improves the readability of global-buffer-overflow reports. llvm-svn: 146698
* [asan] fix a bug (issue 19) where dlclose and the following mmap caused a ↵Kostya Serebryany2011-12-152-5/+32
| | | | | | false positive. compiler part. llvm-svn: 146688
OpenPOWER on IntegriCloud