summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Instead of keeping two Value*->id# mappings, keep one Value->Value mapping andNick Lewycky2011-02-201-12/+14
| | | | | | | one Value set. This is faster because we only need to use the set when there isn't already an entry in the map. No functionality change! llvm-svn: 126076
* When removing a function from the function set and adding it to deferred, weNick Lewycky2011-02-091-2/+19
| | | | | | | | | | | | | could end up removing a different function than we intended because it was functionally equivalent, then end up with a comparison of a function against itself in the next round of comparisons (the one in the function set and the one on the deferred list). To fix this, I introduce a choice in the form of comparison for ComparableFunctions, either normal or "pointer only" used to find exact Function*'s in lookups. Also add some debugging statements. llvm-svn: 125180
* Simplify away redundant test, and document what's going on.Nick Lewycky2011-02-061-2/+5
| | | | llvm-svn: 124977
* Remove specialized comparison of InlineAsm objects. They're uniqued on creationNick Lewycky2011-02-061-6/+2
| | | | | | now, and this wasn't comparing some of their relevant bits anyhow. llvm-svn: 124976
* Remove wasteful caching. This isn't needed for correctness because any functionNick Lewycky2011-02-021-23/+2
| | | | | | | | that might have changed been affected by a merge elsewhere will have been removed from the function set, and it isn't needed for performance because we call grow() ahead of time to prevent reallocations. llvm-svn: 124717
* Rename functions to follow coding standard. Also rejiggers comments. NoNick Lewycky2011-01-281-89/+88
| | | | | | functionality change. llvm-svn: 124482
* Add a doxygen comment for this class.Nick Lewycky2011-01-281-0/+2
| | | | llvm-svn: 124480
* Reorder for readability. (Chris, is this what you meant?)Nick Lewycky2011-01-281-148/+150
| | | | llvm-svn: 124479
* Reduce the number of functions we look at in the first pass, and preallocateNick Lewycky2011-01-281-1/+3
| | | | | | the function equality set. llvm-svn: 124475
* Unbreak the build.Benjamin Kramer2011-01-271-1/+1
| | | | llvm-svn: 124426
* Expound upon this comparison!Nick Lewycky2011-01-271-0/+2
| | | | llvm-svn: 124406
* Use dyn_cast instead of isa+cast.Nick Lewycky2011-01-271-2/+1
| | | | llvm-svn: 124404
* Fix surprising missed optimization in mergefunc where we forgot to considerNick Lewycky2011-01-271-3/+12
| | | | | | that relationships like "i8* null" is equivalent to "i32* null". llvm-svn: 124368
* AttrListPtr has an overloaded operator== which does this for us, we should useNick Lewycky2011-01-261-4/+2
| | | | | | it. No functionality change! llvm-svn: 124286
* Teach mergefunc that intptr_t is the same width as a pointer. We still can'tNick Lewycky2011-01-261-1/+7
| | | | | | | merge vector<intptr_t>::push_back() and vector<void*>::push_back() because Enumerate() doesn't realize that "i64* null" and "i8** null" are equivalent. llvm-svn: 124285
* There are no vectors of pointer or arrays, so we don't need to check vectorNick Lewycky2011-01-261-7/+1
| | | | | | elements for type equivalence. llvm-svn: 124284
* Teach mergefunc how to emit aliases safely again -- but keep it turned it offNick Lewycky2011-01-251-25/+79
| | | | | | | for now. It's controlled by the HasGlobalAliases variable which is not attached to any flag yet. llvm-svn: 124182
* Add a cache that protects mergefunc's internals from more surprises in DenseSet.Nick Lewycky2011-01-151-5/+27
| | | | | | Also, replace tabs with spaces. Yes, it's 2011. llvm-svn: 123535
* Also remove functions that use complex constant expressions in terms ofNick Lewycky2011-01-021-5/+18
| | | | | | another function. llvm-svn: 122705
* Remove functions from the FnSet when one of their callee's is being merged. ThisNick Lewycky2011-01-021-82/+66
| | | | | | | | | | | maintains the guarantee that the DenseSet expects two elements it contains to not go from inequal to equal under its nose. As a side-effect, this also lets us switch from iterating to a fixed-point to actually maintaining a work queue of functions to look at again, and we don't add thunks to our work queue so we don't need to detect and ignore them. llvm-svn: 122677
* RetOp is not actually used for anything useful (thoughDuncan Sands2010-10-211-2/+0
| | | | | | | it looks like maybe it was supposed to be used in the test...), so zap it (gcc-4.6 warning). llvm-svn: 117023
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | 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. llvm-svn: 116820
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
* Fix major bug in thunk detection. Also verify the calling convention.Nick Lewycky2010-09-071-22/+39
| | | | | | | | | Switch from isWeakForLinker to mayBeOverridden which is more accurate. Add more statistics and debugging info. Add comments. Move static function outside anonymous namespace. llvm-svn: 113190
* Switch FnSet to containing the ComparableFunction instead of a pointer to one.Nick Lewycky2010-09-051-36/+67
| | | | | | This reduces malloc traffic (yay!) and removes MergeFunctionsEqualityInfo. llvm-svn: 113105
* Fix many bugs when merging weak-strong and weak-weak pairs. We now merge allNick Lewycky2010-09-051-98/+183
| | | | | | | strong functions first to make sure they're the canonical definitions and then do a second pass looking only for weak functions. llvm-svn: 113104
* Fix an infinite loop; merging two functions will create a new function (if theNick Lewycky2010-08-311-31/+45
| | | | | | | | | two are weak, we make them thunks to a new strong function) so don't iterate through the function list as we're modifying it. Also add back the outermost loop which got removed during the cleanups. llvm-svn: 112595
* Switch to DenseSet, simplifying much more code. We now have a single iterationNick Lewycky2010-08-311-78/+83
| | | | | | | where we hash, compare and fold, instead of one iteration where we build up the hash buckets and a second one to fold. llvm-svn: 112582
* remove unions from LLVM IR. They are severely buggy and notChris Lattner2010-08-281-14/+0
| | | | | | being actively maintained, improved, or extended. llvm-svn: 112356
* Fix a use after free error caught by the valgrind builders.Nick Lewycky2010-08-091-2/+4
| | | | llvm-svn: 110601
* Do more to modernize MergeFunctions. Refactor in response to Chris' code review.Nick Lewycky2010-08-081-91/+81
| | | | llvm-svn: 110538
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Work in progress, cleaning up MergeFuncs.Nick Lewycky2010-08-061-180/+40
| | | | | | | | Further clean up the comparison function by removing overly generalized "domains". Remove all understanding of ELF aliases and simplify folding code and comments. llvm-svn: 110434
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* Fix a -Wreorder warning.Daniel Dunbar2010-08-021-1/+1
| | | | llvm-svn: 110022
* Work in progress.Nick Lewycky2010-08-021-129/+164
| | | | | | | | Start cleaning up MergeFunctions to look more like the rest of LLVM. The primary change here is to move the methods responsible for comparison into the new FunctionComparator object. Some comments added. There's more to do. llvm-svn: 110021
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-1/+1
| | | | llvm-svn: 109045
* Arrays and vectors with different numbers of elements are not equivalent.Nick Lewycky2010-07-161-4/+10
| | | | llvm-svn: 108517
* This is a full sentence.Nick Lewycky2010-07-151-1/+1
| | | | llvm-svn: 108418
* Disable aliases on all platforms.Nick Lewycky2010-07-151-0/+5
| | | | llvm-svn: 108417
* Rename "Release" builds as "Release+Asserts"; rename "Release-Asserts"Duncan Sands2010-07-071-1/+1
| | | | | | | | | | | | | builds to "Release". The default build is unchanged (optimization on, assertions on), however it is now called Release+Asserts. The intent is that future LLVM releases released via llvm.org will be Release builds in the new sense, i.e. will have assertions disabled (currently they have assertions enabled, for a more than 20% slowdown). This will bring them in line with MacOS releases, which ship with assertions disabled. It also means that "Release" now means the same things in make and cmake builds: cmake already disables assertions for "Release" builds AFAICS. llvm-svn: 107758
* Implement the "linker_private_weak" linkage type. This will be used forBill Wendling2010-07-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | Objective-C metadata types which should be marked as "weak", but which the linker will remove upon final linkage. However, this linkage isn't specific to Objective-C. For example, the "objc_msgSend_fixup_alloc" symbol is defined like this: .globl l_objc_msgSend_fixup_alloc .weak_definition l_objc_msgSend_fixup_alloc .section __DATA, __objc_msgrefs, coalesced .align 3 l_objc_msgSend_fixup_alloc: .quad _objc_msgSend_fixup .quad L_OBJC_METH_VAR_NAME_1 This is different from the "linker_private" linkage type, because it can't have the metadata defined with ".weak_definition". Currently only supported on Darwin platforms. llvm-svn: 107433
* Revert r107205 and r107207.Bill Wendling2010-06-291-1/+0
| | | | llvm-svn: 107215
* Introducing the "linker_weak" linkage type. This will be used for Objective-CBill Wendling2010-06-291-0/+1
| | | | | | | | | | | | | | | | | | | metadata types which should be marked as "weak", but which the linker will remove upon final linkage. For example, the "objc_msgSend_fixup_alloc" symbol is defined like this: .globl l_objc_msgSend_fixup_alloc .weak_definition l_objc_msgSend_fixup_alloc .section __DATA, __objc_msgrefs, coalesced .align 3 l_objc_msgSend_fixup_alloc: .quad _objc_msgSend_fixup .quad L_OBJC_METH_VAR_NAME_1 This is different from the "linker_private" linkage type, because it can't have the metadata defined with ".weak_definition". llvm-svn: 107205
* Remove heinous tabs.Nick Lewycky2010-05-131-7/+7
| | | | llvm-svn: 103700
* Replace the core comparison login in merge functions. We can now mergeNick Lewycky2010-05-131-192/+276
| | | | | | | | | | | | | | | | | | | | | | | | vector<>::push_back() in: int foo(vector<int> &a, vector<unsigned> &b) { a.push_back(10); b.push_back(11); } to two calls to the same push_back function, or fold away the two copies of push_back() in: struct T { int; }; struct S { char; }; vector<T*> t; vector<S*> s; void f(T *x) { t.push_back(x); } void g(S *x) { s.push_back(x); } but leave f() and g() separate, since they refer to two different global variables. llvm-svn: 103698
* Kill ModuleProvider and ghost linkage by inverting the relationship betweenJeffrey Yasskin2010-01-271-1/+0
| | | | | | | | | | | | | | | | | | | | | Modules and ModuleProviders. Because the "ModuleProvider" simply materializes GlobalValues now, and doesn't provide modules, it's renamed to "GVMaterializer". Code that used to need a ModuleProvider to materialize Functions can now materialize the Functions directly. Functions no longer use a magic linkage to record that they're materializable; they simply ask the GVMaterializer. Because the C ABI must never change, we can't remove LLVMModuleProviderRef or the functions that refer to it. Instead, because Module now exposes the same functionality ModuleProvider used to, we store a Module* in any LLVMModuleProviderRef and translate in the wrapper methods. The bindings to other languages still use the ModuleProvider concept. It would probably be worth some time to update them to follow the C++ more closely, but I don't intend to do it. Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735. llvm-svn: 94686
* Avoid going through the LLVMContext for type equality where it's safe to ↵Benjamin Kramer2010-01-051-1/+1
| | | | | | dereference the type pointer. llvm-svn: 92726
* Change errs() to dbgs().David Greene2010-01-051-3/+3
| | | | llvm-svn: 92633
OpenPOWER on IntegriCloud