Commit Graph

85 Commits

Author SHA1 Message Date
Bill Wendling ea6397f67b Remove tabs.
llvm-svn: 160477
2012-07-19 00:11:40 +00:00
Chandler Carruth aafe0918bc Move llvm/Support/IRBuilder.h -> llvm/IRBuilder.h
This was always part of the VMCore library out of necessity -- it deals
entirely in the IR. The .cpp file in fact was already part of the VMCore
library. This is just a mechanical move.

I've tried to go through and re-apply the coding standard's preferred
header sort, but at 40-ish files, I may have gotten some wrong. Please
let me know if so.

I'll be committing the corresponding updates to Clang and Polly, and
Duncan has DragonEgg.

Thanks to Bill and Eric for giving the green light for this bit of cleanup.

llvm-svn: 159421
2012-06-29 12:38:19 +00:00
Eli Friedman 211e348eaa Update inter-procedural optimizations for atomic load/store.
llvm-svn: 137667
2011-08-15 22:16:46 +00:00
Eli Friedman adec587d5c Misc optimizer+codegen work for 'cmpxchg' and 'atomicrmw'. They appear to be
working on x86 (at least for trivial testcases); other architectures will
need more work so that they actually emit the appropriate instructions for
orderings stricter than 'monotonic'. (As far as I can tell, the ARM, PPC,
Mips, and Alpha backends need such changes.)

llvm-svn: 136457
2011-07-29 03:05:32 +00:00
Jay Foad bf904773bb Convert TargetData::getIndexedOffset to use ArrayRef.
llvm-svn: 135478
2011-07-19 14:01:37 +00:00
Chris Lattner 229907cd11 land David Blaikie's patch to de-constify Type, with a few tweaks.
llvm-svn: 135375
2011-07-18 04:54:35 +00:00
Jay Foad 5bd375a6cc Convert CallInst and InvokeInst APIs to use ArrayRef.
llvm-svn: 135265
2011-07-15 08:37:34 +00:00
Chris Lattner b1ed91f397 Land the long talked about "type system rewrite" patch. This
patch brings numerous advantages to LLVM.  One way to look at it
is through diffstat:
 109 files changed, 3005 insertions(+), 5906 deletions(-)

Removing almost 3K lines of code is a good thing.  Other advantages
include:

1. Value::getType() is a simple load that can be CSE'd, not a mutating
   union-find operation.
2. Types a uniqued and never move once created, defining away PATypeHolder.
3. Structs can be "named" now, and their name is part of the identity that
   uniques them.  This means that the compiler doesn't merge them structurally
   which makes the IR much less confusing.
4. Now that there is no way to get a cycle in a type graph without a named
   struct type, "upreferences" go away.
5. Type refinement is completely gone, which should make LTO much MUCH faster
   in some common cases with C++ code.
6. Types are now generally immutable, so we can use "Type *" instead 
   "const Type *" everywhere.

Downsides of this patch are that it removes some functions from the C API,
so people using those will have to upgrade to (not yet added) new API.  
"LLVM 3.0" is the right time to do this.

There are still some cleanups pending after this, this patch is large enough
as-is.

llvm-svn: 134829
2011-07-09 17:41:24 +00:00
Jay Foad 7c14a558fe Don't include Operator.h from InstrTypes.h.
llvm-svn: 129271
2011-04-11 09:35:34 +00:00
Nick Lewycky 0e25c8b364 No functionality change, just adjust some whitespace for coding style compliance.
llvm-svn: 128257
2011-03-25 06:05:50 +00:00
Nick Lewycky 080ea93779 Instead of keeping two Value*->id# mappings, keep one Value->Value mapping and
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
2011-02-20 08:11:03 +00:00
Nick Lewycky 292e78c3cd When removing a function from the function set and adding it to deferred, we
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
2011-02-09 06:32:02 +00:00
Nick Lewycky cb1a4c26ee Simplify away redundant test, and document what's going on.
llvm-svn: 124977
2011-02-06 05:04:00 +00:00
Nick Lewycky f8797fda44 Remove specialized comparison of InlineAsm objects. They're uniqued on creation
now, and this wasn't comparing some of their relevant bits anyhow.

llvm-svn: 124976
2011-02-06 04:33:50 +00:00
Nick Lewycky a46c898314 Remove wasteful caching. This isn't needed for correctness because any function
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
2011-02-02 05:31:01 +00:00
Nick Lewycky cfb284cf96 Rename functions to follow coding standard. Also rejiggers comments. No
functionality change.

llvm-svn: 124482
2011-01-28 08:43:14 +00:00
Nick Lewycky aaf401241a Add a doxygen comment for this class.
llvm-svn: 124480
2011-01-28 08:19:00 +00:00
Nick Lewycky 564fcca856 Reorder for readability. (Chris, is this what you meant?)
llvm-svn: 124479
2011-01-28 07:36:21 +00:00
Nick Lewycky c5eb3733f7 Reduce the number of functions we look at in the first pass, and preallocate
the function equality set.

llvm-svn: 124475
2011-01-28 05:48:15 +00:00
Benjamin Kramer 57e3d65884 Unbreak the build.
llvm-svn: 124426
2011-01-27 20:30:54 +00:00
Nick Lewycky e2d46d30ae Expound upon this comparison!
llvm-svn: 124406
2011-01-27 19:51:31 +00:00
Nick Lewycky 5a37e950e1 Use dyn_cast instead of isa+cast.
llvm-svn: 124404
2011-01-27 19:42:43 +00:00
Nick Lewycky 13e04aef2a Fix surprising missed optimization in mergefunc where we forgot to consider
that relationships like "i8* null" is equivalent to "i32* null".

llvm-svn: 124368
2011-01-27 08:38:19 +00:00
Nick Lewycky 91543447a6 AttrListPtr has an overloaded operator== which does this for us, we should use
it. No functionality change!

llvm-svn: 124286
2011-01-26 09:23:19 +00:00
Nick Lewycky 82d4db8662 Teach mergefunc that intptr_t is the same width as a pointer. We still can't
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
2011-01-26 09:13:58 +00:00
Nick Lewycky fb622f9920 There are no vectors of pointer or arrays, so we don't need to check vector
elements for type equivalence.

llvm-svn: 124284
2011-01-26 08:50:18 +00:00
Nick Lewycky f1cec164ce Teach mergefunc how to emit aliases safely again -- but keep it turned it off
for now. It's controlled by the HasGlobalAliases variable which is not attached
to any flag yet.

llvm-svn: 124182
2011-01-25 08:56:50 +00:00
Nick Lewycky 540f9536c8 Add a cache that protects mergefunc's internals from more surprises in DenseSet.
Also, replace tabs with spaces. Yes, it's 2011.

llvm-svn: 123535
2011-01-15 10:16:23 +00:00
Nick Lewycky 5361b84184 Also remove functions that use complex constant expressions in terms of
another function.

llvm-svn: 122705
2011-01-02 19:16:44 +00:00
Nick Lewycky 4e250c8245 Remove functions from the FnSet when one of their callee's is being merged. This
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
2011-01-02 02:46:33 +00:00
Duncan Sands 94da154558 RetOp is not actually used for anything useful (though
it looks like maybe it was supposed to be used in the
test...), so zap it (gcc-4.6 warning).

llvm-svn: 117023
2010-10-21 16:05:44 +00:00
Owen Anderson 6c18d1aac0 Get rid of static constructors for pass registration. Instead, every pass 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
2010-10-19 17:21:58 +00:00
Owen Anderson df7a4f2515 Now with fewer extraneous semicolons!
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Nick Lewycky 71972d45dc Fix major bug in thunk detection. Also verify the calling convention.
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
2010-09-07 01:42:10 +00:00
Nick Lewycky f3a07ec394 Switch FnSet to containing the ComparableFunction instead of a pointer to one.
This reduces malloc traffic (yay!) and removes MergeFunctionsEqualityInfo.

llvm-svn: 113105
2010-09-05 09:00:32 +00:00
Nick Lewycky 0095937b13 Fix many bugs when merging weak-strong and weak-weak pairs. We now merge all
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
2010-09-05 08:22:49 +00:00
Nick Lewycky 68984ede5c Fix an infinite loop; merging two functions will create a new function (if the
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
2010-08-31 08:29:37 +00:00
Nick Lewycky 0464d1d7ec Switch to DenseSet, simplifying much more code. We now have a single iteration
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
2010-08-31 05:53:05 +00:00
Chris Lattner 13ee795c42 remove unions from LLVM IR. They are severely buggy and not
being actively maintained, improved, or extended.

llvm-svn: 112356
2010-08-28 04:09:24 +00:00
Nick Lewycky f0067b668c Fix a use after free error caught by the valgrind builders.
llvm-svn: 110601
2010-08-09 21:03:28 +00:00
Nick Lewycky fbd2757cde Do more to modernize MergeFunctions. Refactor in response to Chris' code review.
llvm-svn: 110538
2010-08-08 05:04:23 +00:00
Owen Anderson a7aed18624 Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Nick Lewycky f216f69ad9 Work in progress, cleaning up MergeFuncs.
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
2010-08-06 07:21:30 +00:00
Owen Anderson bda59bd247 Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson 755aceb5d0 Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Daniel Dunbar c1b09c8644 Fix a -Wreorder warning.
llvm-svn: 110022
2010-08-02 05:43:46 +00:00
Nick Lewycky f52bd9cc33 Work in progress.
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
2010-08-02 05:23:03 +00:00
Owen Anderson a57b97e7e7 Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Nick Lewycky 375efe3157 Arrays and vectors with different numbers of elements are not equivalent.
llvm-svn: 108517
2010-07-16 06:31:12 +00:00
Nick Lewycky 485ce5a49c This is a full sentence.
llvm-svn: 108418
2010-07-15 06:51:22 +00:00