summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* revert my previous commit (r159173), since as Eli pointed out, it's ↵Nuno Lopes2012-06-251-0/+1
| | | | | | perfectly ok to mark realloc as noalias llvm-svn: 159175
* do not set realloc() as NotAlias, since it can return the same pointer. This ↵Nuno Lopes2012-06-251-1/+0
| | | | | | whole thing should be upgraded to use the MemoryBuiltin interface anyway.. llvm-svn: 159173
* Fix the objc_autoreleasedReturnValue optimization code to locateDan Gohman2012-06-251-2/+17
| | | | | | | the call correctly even in the case where it is an invoke. This fixes rdar://11714057. llvm-svn: 159157
* improve optimization of invoke instructions:Nuno Lopes2012-06-252-3/+15
| | | | | | | | - simplifycfg: invoke undef/null -> unreachable - instcombine: invoke new -> invoke expect(0, 0) (an arbitrary NOOP intrinsic; only done if the allocated memory is unused, of course) - verifier: allow invoke of intrinsics (to make the previous step work) llvm-svn: 159146
* If a constant or a function has linkonce_odr linkage and unnamed_addr, mark itRafael Espindola2012-06-251-0/+11
| | | | | | | | hidden. Being linkonce_odr guarantees that it is available in every dso that needs it. Being a constant/function with unnamed_addr guarantees that the copies don't have to be merged. llvm-svn: 159136
* The name (and comment describing) of llvm::GetFirstDebuigLocInBasicBlock no ↵Eli Bendersky2012-06-252-11/+5
| | | | | | longer represents what the function does. Therefore, the function is removed and its functionality is folded into the only place in the code-base where it was being used. llvm-svn: 159133
* llvm/lib: [CMake] Add explicit dependency to intrinsics_gen.NAKAMURA Takumi2012-06-246-0/+12
| | | | llvm-svn: 159112
* Allow controlling vectorization of boolean values separately from other ↵Hal Finkel2012-06-241-4/+14
| | | | | | | | integer types. These are used as the result of comparisons, and often handled differently from larger integer types. llvm-svn: 159111
* Remove dyn_cast + dereference pattern by replacing it with a cast and changingNick Lewycky2012-06-241-3/+3
| | | | | | | the safety check to look for the same type we're going to actually cast to. Fixes PR13180! llvm-svn: 159110
* Tab to spaces. No functionality change.Nick Lewycky2012-06-241-1/+1
| | | | llvm-svn: 159104
* Remove a dangling reference to a deleted instruction. Fixes PR13185!Nick Lewycky2012-06-241-0/+1
| | | | llvm-svn: 159096
* Allow BBVectorize to fuse compare instructions.Hal Finkel2012-06-231-0/+8
| | | | llvm-svn: 159088
* Extend the IL for selecting TLS models (PR9788)Hans Wennborg2012-06-234-10/+10
| | | | | | | | | | | | | | | This allows the user/front-end to specify a model that is better than what LLVM would choose by default. For example, a variable might be declared as @x = thread_local(initialexec) global i32 42 if it will not be used in a shared library that is dlopen'ed. If the specified model isn't supported by the target, or if LLVM can make a better choice, a different model may be used. llvm-svn: 159077
* Optimized usage of new SwitchInst case values (IntegersSubset type) in ↵Stepan Dyatkovskiy2012-06-231-4/+3
| | | | | | | | Local.cpp, Execution.cpp and BitcodeWriter.cpp. I got about 1% of compile-time improvement on my machines (Ubuntu 11.10 i386 and Ubuntu 12.04 x64). llvm-svn: 159076
* BoundsChecking: attach debug info to traps to make my life a bit more saneNuno Lopes2012-06-231-9/+10
| | | | llvm-svn: 159055
* Revert remaining part of r93200: "Disable folding sext(trunc(x)) -> x"Jakob Stoklund Olesen2012-06-221-9/+4
| | | | | | | | | | | This fixes PR5997. These transforms were disabled because codegen couldn't deal with other uses of trunc(x). This is now handled by the peephole pass. This causes no regressions on x86-64. llvm-svn: 159003
* Fixed r158979.Stepan Dyatkovskiy2012-06-221-1/+2
| | | | | | | | | | Original message: Performance optimizations: - SwitchInst: case values stored separately from Operands List. It allows to make faster access to individual case value numbers or ranges. - Optimized IntItem, added APInt value caching. - Optimized IntegersSubsetGeneric: added optimizations for cases when subset is single number or when subset consists from single numbers only. llvm-svn: 158997
* fix whitespace in my last commit.Nuno Lopes2012-06-221-1/+1
| | | | | | sorry for the churn :S enough for today; going to sleep. llvm-svn: 158953
* remove extractMallocCallFromBitCast, since it was tailor maded for its sole ↵Nuno Lopes2012-06-221-2/+4
| | | | | | user. Update GlobalOpt accordingly. llvm-svn: 158952
* instcombine: disable optimization of 'invoke null/undef'. I'll move this ↵Nuno Lopes2012-06-211-11/+11
| | | | | | | | functionality to SimplifyCFG (since we cannot make changes to the CFG here). Fixes the crashes with the attached test case llvm-svn: 158951
* Look pass zext to strength reduce an udiv. Patch by David Majnemer. ↵Evan Cheng2012-06-211-1/+4
| | | | | | rdar://11721329 llvm-svn: 158946
* Add support for invoke to the MemoryBuiltin analysid.Nuno Lopes2012-06-212-2/+7
| | | | | | | | Update comments accordingly. Make instcombine remove useless invokes to C++'s 'new' allocation function (test attached). llvm-svn: 158937
* port the BoundsChecking patch to the new MemoryBuiltin API (i.e., remove ↵Nuno Lopes2012-06-211-393/+30
| | | | | | | | most of the code from here). Remove the alloc_size.ll test until we settle on a metadata format that makes everyone happy.. llvm-svn: 158920
* refactor the MemoryBuiltin analysis:Nuno Lopes2012-06-215-136/+19
| | | | | | | | | | | | - provide more extensive set of functions to detect library allocation functions (e.g., malloc, calloc, strdup, etc) - provide an API to compute the size and offset of an object pointed by Move a few clients (GVN, AA, instcombine, ...) to the new API. This implementation is a lot more aggressive than each of the custom implementations being replaced. Patch reviewed by Nick Lewycky and Chandler Carruth, thanks. llvm-svn: 158919
* Add a number of threshold arguments to the SRA pass.Nadav Rotem2012-06-211-18/+60
| | | | | | A patch by Tom Stellard with minor changes. llvm-svn: 158918
* replace usage of EmitGEPOffset() with TargetData::getIndexedOffset() when ↵Nuno Lopes2012-06-202-8/+6
| | | | | | | | | | the GEP offset is known to be constant. With this change, we avoid relying on the IR Builder to constant fold the operations. No functionality change intended. llvm-svn: 158829
* Fix two rather subtle internal vs. external linker issues.Chandler Carruth2012-06-201-25/+20
| | | | | | | | | | | | | | | | | | | | | | I'll admit I'm not entirely satisfied with this change, but it seemed the cleanest option. Other suggestions quite welcome The issue is that the traits specializations have static methods which return the typedef'ed PHI_iterator type. In both the IR and MI layers this is typedef'ed to a custom iterator class defined in an anonymous namespace giving the types and the functions returning them internal linkage. However, because the traits specialization is defined in the 'llvm' namespace (where it has to be, specialized template lives there), and is in turn used in the templated implementation of the SSAUpdater. This led to the linkage conflict that Clang now warns about. The simplest solution to me was just to define the PHI_iterator as a nested class inside the trait specialization. That way it still doesn't get scoped widely, it can't be accidentally reused somewhere, etc. This is a little gross just because nested class definitions are a little gross, but the alternatives seem more ad-hoc. llvm-svn: 158799
* Now that SROA can form alloca's for dynamic vector accesses, further improve ↵Pete Cooper2012-06-171-28/+99
| | | | | | it to be able to replace operations on these vector alloca's with insert/extract element insts llvm-svn: 158623
* Teach BBVectorize to combine, when possible, or discard metadata when fusing ↵Hal Finkel2012-06-161-0/+30
| | | | | | | | | | | | instructions. The present implementation handles only TBAA and FP metadata, discarding everything else. For debug metadata, the current behavior is maintained (the debug metadata associated with one of the instructions will be kept, discarding that attached to the other). This should address PR 13040. llvm-svn: 158606
* Move the Metadata merging methods from GVN and make them public in MDNode.Hal Finkel2012-06-161-153/+3
| | | | | | | There are other passes, BBVectorize specifically, that also need some of this functionality. llvm-svn: 158605
* It's not deterministic to iterate over SmallPtrSet. Replace it with ↵Evan Cheng2012-06-161-14/+14
| | | | | | SmallSetVector. Patch by Daniel Reynaud. rdar://11671029 llvm-svn: 158594
* Fix crash from r158529 on Bullet.Pete Cooper2012-06-161-1/+10
| | | | | | | | Dynamic GEPs created by SROA needed to insert extra "i32 0" operands to index through structs and arrays to get to the vector being indexed. llvm-svn: 158590
* LSR: fix expansion of scaled reg in non-address type formulae.Andrew Trick2012-06-151-13/+17
| | | | | | | | | For non-address users, Base and Scaled registers are not specially associated to fit an address mode, so SCEVExpander should apply normal expansion rules. Otherwise we may sink computation into inner loops that have already been optimized. llvm-svn: 158537
* LSR fix: "Special" users are just like "Basic" users but allow -1 scale.Andrew Trick2012-06-151-2/+2
| | | | llvm-svn: 158536
* Allow SROA to split up an array of vectors into multiple vectors, even when ↵Pete Cooper2012-06-151-3/+29
| | | | | | the vectors are dynamically indexed llvm-svn: 158529
* Some optimizations done by globalopt are safe only for internal linkage, notRafael Espindola2012-06-151-0/+3
| | | | | | | | linkonce linkage. For example, it is not valid to add unnamed_addr. This also fixes a crash in g++.dg/opt/static5.C. llvm-svn: 158528
* Fix issues (infinite loop and/or crash) with self-referential instructions, forDuncan Sands2012-06-151-6/+14
| | | | | | | example degenerate phi nodes and binops that use themselves in unreachable code. Thanks to Charles Davis for the testcase that uncovered this can of worms. llvm-svn: 158508
* Recommit r158407: Allow SROA to look at a vector type and see if the offset ↵Pete Cooper2012-06-141-2/+15
| | | | | | is out of range to be replaced with a scalar access. Now with additional fix and test for indexing into a vector inside a struct llvm-svn: 158479
* Implement the isSafeToDiscardIfUnused predicate and use it in globalopt andRafael Espindola2012-06-142-4/+4
| | | | | | | globaldce. Globaldce was already removing linkonce globals, but globalopt was not. llvm-svn: 158476
* Revert r158454: Allow SROA to look at a vector type... Its breaking the ↵Pete Cooper2012-06-141-15/+2
| | | | | | | | vectorise buildbot This reverts commit 12c1f86ffa731e2952c80d2cc577000c96b8962c. llvm-svn: 158462
* Recommit r158407: Allow SROA to look at a vector type and see if the offset ↵Pete Cooper2012-06-141-2/+15
| | | | | | is out of range to be replaced with a scalar access. Now with additional fix and test for indexing into a vector inside a struct llvm-svn: 158454
* InstCombine: fix a bug when combining (fcmp cc0 x, y) && (fcmp cc1 x, y).Manman Ren2012-06-141-2/+4
| | | | | | uno && ueq was converted to ueq, it should be converted to uno. llvm-svn: 158441
* Revert "Allow SROA to look at a vector type and see if the offset is out of ↵Pete Cooper2012-06-131-6/+0
| | | | | | | | range to be replaced with a scalar access" This reverts commit 51786e0aaec76b973205066bd44f7f427b21969f. llvm-svn: 158408
* Allow SROA to look at a vector type and see if the offset is out of range to ↵Pete Cooper2012-06-131-0/+6
| | | | | | be replaced with a scalar access llvm-svn: 158407
* It is possible for several constants which aren't individually absorbing toDuncan Sands2012-06-131-1/+6
| | | | | | | combine to the absorbing element. Thanks to nbjoerg on IRC for pointing this out. llvm-svn: 158399
* When linearizing a multiplication, return at once if we see a factor of zero,Duncan Sands2012-06-131-40/+14
| | | | | | | | | since then the entire expression must equal zero (similarly for other operations with an absorbing element). With this in place a bunch of reassociate code for handling constants is dead since it is all taken care of when linearizing. No intended functionality change. llvm-svn: 158398
* SimplifyCFG: fold unconditional branch to its predecessor if profitable.Manman Ren2012-06-131-24/+180
| | | | | | | | | | This patch extends FoldBranchToCommonDest to fold unconditional branches. For unconditional branches, we fold them if it is easy to update the phi nodes in the common successors. rdar://10554090 llvm-svn: 158392
* Use DenseMap as SmallMap workaround rather than std::map, at Chandler's request.Duncan Sands2012-06-121-1/+1
| | | | llvm-svn: 158371
* Use std::map rather than SmallMap because SmallMap assumes that the value hasDuncan Sands2012-06-121-2/+1
| | | | | | | POD type, causing memory corruption when mapping to APInts with bitwidth > 64. Merge another crash testcase into crash.ll while there. llvm-svn: 158369
* Now that Reassociate's LinearizeExprTree can look through arbitrary expressionDuncan Sands2012-06-121-25/+204
| | | | | | | | | | | | | | | | | topologies, it is quite possible for a leaf node to have huge multiplicity, for example: x0 = x*x, x1 = x0*x0, x2 = x1*x1, ... rapidly gives a value which is x raised to a vast power (the multiplicity, or weight, of x). This patch fixes the computation of weights by correctly computing them no matter how big they are, rather than just overflowing and getting a wrong value. It turns out that the weight for a value never needs more bits to represent than the value itself, so it is enough to represent weights as APInts of the same bitwidth and do the right overflow-avoiding dance steps when computing weights. As a side-effect it reduces the number of multiplies needed in some cases of large powers. While there, in view of external uses (eg by the vectorizer) I made LinearizeExprTree static, pushing the rank computation out into users. This is progress towards fixing PR13021. llvm-svn: 158358
OpenPOWER on IntegriCloud