summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of an optimization in SCCP which appears to have many issues. ↵Eli Friedman2011-11-111-167/+1
| | | | | | | | | | Specifically, it doesn't handle many cases involving undef correctly, and it is missing other checks which lead to it trying to re-mark a value marked as a constant with a different value. It also appears to trigger very rarely. Fixes PR11357. llvm-svn: 144352
* Fixed bug in DeadStoreElimination commit r144239Pete Cooper2011-11-101-1/+1
| | | | | | | | Size of data being pointed to wasn't always being checked so some small writes were killing big writes Fixes <rdar://problem/10426753> llvm-svn: 144312
* DeadStoreElimination can now trim the size of a store if the end of the ↵Pete Cooper2011-11-091-33/+110
| | | | | | | | | | | store is dead. Currently checks alignment and killing stores on a power of 2 boundary as this is likely to trim the size of the earlier store without breaking large vector stores into scalar ones. Fixes <rdar://problem/10140300> llvm-svn: 144239
* LICM pass now understands invariant load metadata. Nothing generates this ↵Pete Cooper2011-11-081-0/+2
| | | | | | yet so it will currently never get used in real tests llvm-svn: 144107
* InstCombine now optimizes vector udiv by power of 2 to shiftsPete Cooper2011-11-071-5/+9
| | | | | | Fixes r8429 llvm-svn: 144036
* Make sure we don't insert instructions before a landingpad instruction.Bill Wendling2011-11-071-2/+2
| | | | | | <rdar://problem/10405911> llvm-svn: 144000
* Do simple cross-block DSE when we encounter a free statement. Fixes PR11240.Nick Lewycky2011-11-051-25/+56
| | | | llvm-svn: 143808
* Speculatively revert "DeadStoreElimination can now trim the size of a store ifDaniel Dunbar2011-11-041-109/+33
| | | | | | the end of it is dead.", which appears to break bootstrapping LLVM. llvm-svn: 143668
* build: Add initial cut at LLVMBuild.txt files.Daniel Dunbar2011-11-036-0/+139
| | | | llvm-svn: 143634
* DeadStoreElimination can now trim the size of a store if the end of it is dead.Pete Cooper2011-11-031-33/+109
| | | | | | | | | | Only currently done if the later store is writing to a power of 2 address or has the same alignment as the earlier store as then its likely to not break up large stores into smaller ones Fixes <rdar://problem/10140300> llvm-svn: 143630
* Rewrite LinearFunctionTestReplace to handle pointer-type IVs.Andrew Trick2011-11-021-73/+116
| | | | | | | | We've been hitting asserts in this code due to the many supported combintions of modes (iv-rewrite/no-iv-rewrite) and IV types. This second rewrite of the code attempts to deal with these cases systematically. llvm-svn: 143546
* Add parentheses to disambiguate the precedence of these operations andChandler Carruth2011-11-021-2/+2
| | | | | | silence -Wparentheses. llvm-svn: 143534
* Broaden an assert to handle enable-iv-rewrite=true following r143183.Andrew Trick2011-11-021-1/+1
| | | | | | Narrowest possible fix for PR11279. llvm-svn: 143522
* Make sure we use the right insertion point when instcombine replaces a PHI ↵Eli Friedman2011-11-011-3/+4
| | | | | | with another instruction. (Specifically, don't insert an arbitrary instruction before a PHI.) Fixes PR11275. llvm-svn: 143437
* Add utility to append a function to the list of global constructors. Devang Patel2011-10-312-0/+56
| | | | | | Patch by Kostya Serebryany. llvm-svn: 143405
* SimplifyLibCalls: Use IRBuilder.CreateGlobalString when creating a string ↵Benjamin Kramer2011-10-291-4/+2
| | | | | | | | for printf->puts, which correctly sets the unnamed_addr bit on the resulting GlobalVariable. Fixes PR11264. llvm-svn: 143289
* LFTR should avoid a type mismatch with null pointer IVs.Andrew Trick2011-10-281-16/+18
| | | | | | Fixes rdar://10359193 Indvar LinearFunctionTestReplace assertion llvm-svn: 143183
* It is not safe to sink an alloca into a stacksave/stackrestore pair, so ↵Eli Friedman2011-10-271-5/+6
| | | | | | don't do that. <rdar://problem/10352360> llvm-svn: 143093
* A dead malloc, a free(NULL) and a free(undef) are all trivially deadNick Lewycky2011-10-241-0/+8
| | | | | | | | | | instructions. This doesn't introduce any optimizations we weren't doing before (except potentially due to pass ordering issues), now passes will eliminate them sooner as part of their own cleanups. llvm-svn: 142787
* The element insertion code in scalar replacement doesn't handle incorrectCameron Zwarich2011-10-231-2/+4
| | | | | | | 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
* A non-escaping malloc in the entry block is not unlike an alloca. Do dead-storeNick Lewycky2011-10-221-2/+25
| | | | | | elimination on them too. llvm-svn: 142735
* Remap blockaddress correctly when inlining a function. Fixes PR10162.Eli Friedman2011-10-211-1/+32
| | | | llvm-svn: 142684
* 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-211-61/+195
| | | | | | the input and output vectors have different sizes. Patch by Xiaoyi Guo. llvm-svn: 142671
* Refactor code from inlining and globalopt that checks whether a function ↵Eli Friedman2011-10-203-7/+4
| | | | | | definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180. llvm-svn: 142572
* Initialze ScalarEvalution dependency.Devang Patel2011-10-191-0/+1
| | | | | | Patch by Pranav Bhandarkar! llvm-svn: 142556
* Teach the ARC optimizer about the !clang.arc.copy_on_escape metadataDan Gohman2011-10-171-12/+40
| | | | | | | tag on objc_retainBlock calls, which indicates that they may be optimized away. rdar://10211286. llvm-svn: 142298
* Add support for the Objective-C personality function to the instructionBill Wendling2011-10-171-2/+5
| | | | | | | | combining of the landingpad instruction. The ObjC personality function acts almost identically to the C++ personality function. In particular, it uses "null" as a "catch-all" value. llvm-svn: 142256
* Suppress partial retain+release elimination when there's aDan Gohman2011-10-171-2/+24
| | | | | | | possibility that it will span multiple CFG diamonds/triangles which could have different controlling predicates. rdar://10282956 llvm-svn: 142222
* Correct over-zealous removal of hack.Bill Wendling2011-10-171-1/+1
| | | | | | | Some code want to check that *any* call within a function has the 'returns twice' attribute, not just that the current function has one. llvm-svn: 142221
* Now that we have the ReturnsTwice function attribute, this method isBill Wendling2011-10-171-1/+1
| | | | | | | obsolete. Check the attribute instead. <rdar://problem/8031714> llvm-svn: 142212
* Fix CMake build.Michael J. Spencer2011-10-171-0/+1
| | | | llvm-svn: 142204
* svn mv Target/ARM/ARMGlobalMerge.cpp Transforms/Scalar/GlobalMerge.cppDevang Patel2011-10-171-0/+226
| | | | | | There is no reason to have simple IR level pass in lib/Target. llvm-svn: 142200
* Add a routine to swap branch instruction operands, and update anyChandler Carruth2011-10-171-6/+3
| | | | | | | | | | | | profile metadata at the same time. Use it to preserve metadata attached to a branch when re-writing it in InstCombine. Add metadata to the canonicalize_branch InstCombine test, and check that it is tranformed correctly. Reviewed by Nick Lewycky! llvm-svn: 142168
* Add a proper LLVM banner to this file.Chandler Carruth2011-10-161-0/+13
| | | | llvm-svn: 142162
* When looking for dependencies on the src pointer, scan the src pointer. ScanningNick Lewycky2011-10-161-12/+17
| | | | | | on the memcpy call will pull up other unrelated stuff. Fixes PR11142. llvm-svn: 142150
* Don't replace all dominated uses if there is only one use, since thatDuncan Sands2011-10-151-4/+9
| | | | | | use can't be dominated, saving one domtree lookup. llvm-svn: 142066
* Fix indvars randomness by removing iteration over a map.Andrew Trick2011-10-151-12/+12
| | | | | | | | | | | | | I rewrote the algorithm a while back so it doesn't require map lookup, but neglected to change the data structure. This was caught by llvm-gcc self host, not because there's anything special about llvm-gcc, but because it is the only test for nondeterminism we currently have. Unit tests don't work well for everything; we should always try to have a nondeterminism stress test running. Fixes PR11133: llvm-gcc self host .o mismatch after enable-iv-rewrite=false llvm-svn: 142036
* Avoid undefined behavior in negation in LSR. Patch by Ahmed Charles.Eli Friedman2011-10-131-2/+2
| | | | | | Someone more familiar with LSR should double-check that the extra cast is actually doing the right thing in the overflow cases; I'm not completely confident that's that case. llvm-svn: 141916
* Enhance the memdep interface so that users can tell the difference between a ↵Eli Friedman2011-10-132-13/+13
| | | | | | | | dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases. Patch by Xiaoyi Guo. llvm-svn: 141896
* Fix a couple hash functions so that they do not depend on undefined shifts. ↵Eli Friedman2011-10-121-2/+2
| | | | | | Based on patch by Ahmed Charles. llvm-svn: 141820
* Add missing space.Nick Lewycky2011-10-121-1/+1
| | | | llvm-svn: 141750
* Fix PR11106 by correcting a typo that has been in the code for over a year. ThisCameron Zwarich2011-10-111-2/+2
| | | | | | | | would have never worked, since the element type of a vector type is never a vector type. Also fix the conditional to be more direct in checking whether EltTy is a vector type. llvm-svn: 141713
* Remove a lot of the fancy scalar replacement code for dealing with llvm-gcc'sCameron Zwarich2011-10-111-205/+16
| | | | | | | lowering of NEON code. It provides little-to-no benefit now and only introduces additional complexity. llvm-svn: 141646
* Add experimental -enable-lsr-phielim option.Andrew Trick2011-10-111-0/+22
| | | | | | | I'm not sure we will need it in the long run, but the option is currently useful for checking if the output of LSR is "clean". llvm-svn: 141634
* Move replaceCongruentIVs into SCEVExapander and bias toward "expanded"Andrew Trick2011-10-111-87/+6
| | | | | | | | | | | IVs. Indvars previously chose randomly between congruent IVs. Now it will bias the decision toward IVs that SCEVExpander likes to create. This was not done to fix any problem, it's just a welcome side effect of factoring code. llvm-svn: 141633
* Add a natural stack alignment field to TargetData, and prevent InstCombine fromLang Hames2011-10-101-2/+6
| | | | | | | | | | | | | | promoting allocas to preferred alignments that exceed the natural alignment. This avoids some potentially expensive dynamic stack realignments. The natural stack alignment is set in target data strings via the "S<size>" option. Size is in bits and must be a multiple of 8. The natural stack alignment defaults to "unspecified" (represented by a zero value), and the "unspecified" value does not prevent any alignment promotions. Target maintainers that care about avoiding promotions should explicitly add the "S<size>" option to their target data strings. llvm-svn: 141599
* LSR should only reuse phis that match its formula.Andrew Trick2011-10-071-0/+1
| | | | | | Fixes rdar://problem/5064068 llvm-svn: 141442
* Teach GVN to also propagate switch cases. For example, in this codeDuncan Sands2011-10-071-31/+59
| | | | | | | | | | | | | | switch (n) { case 27: do_something(x); ... } the call do_something(x) will be replaced with do_something(27). In gcc-as-one-big-file this results in the removal of about 500 lines of bitcode (about 0.02%), so has about 1/10 of the effect of propagating branch conditions. llvm-svn: 141360
* Remove the old atomic instrinsics. autoupgrade functionality is included ↵Eli Friedman2011-10-061-98/+1
| | | | | | with this patch. llvm-svn: 141333
OpenPOWER on IntegriCloud