1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 12:33:33 +02:00
Commit Graph

103 Commits

Author SHA1 Message Date
Devang Patel
a2ccbea45a Silence unused variable warnings.
llvm-svn: 59841
2008-11-21 20:00:59 +00:00
Nuno Lopes
6dfcc8cf45 fix leakage of ValueNumbering
llvm-svn: 58933
2008-11-09 12:45:23 +00:00
Nick Lewycky
3d4f21006b Add value range analyzing of Add and Sub.
Understand that mul %x, 1 = %x.

llvm-svn: 58069
2008-10-24 04:00:26 +00:00
Dan Gohman
e1f9be27bc Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Chris Lattner
fe3155fc62 Switch the asmprinter (.ll) and all the stuff it requires over to
use raw_ostream instead of std::ostream.  Among other goodness,
this speeds up llvm-dis of kc++ with a release build from 0.85s
to 0.49s (88% faster).

Other interesting changes:
 1) This makes Value::print be non-virtual.
 2) AP[S]Int and ConstantRange can no longer print to ostream directly, 
    use raw_ostream instead.
 3) This fixes a bug in raw_os_ostream where it didn't flush itself 
    when destroyed.
 4) This adds a new SDNode::print method, instead of only allowing "dump".


A lot of APIs have both std::ostream and raw_ostream versions, it would
be useful to go through and systematically anihilate the std::ostream 
versions.

This passes dejagnu, but there may be minor fallout, plz let me know if
so and I'll fix it.

llvm-svn: 55263
2008-08-23 22:23:09 +00:00
Nick Lewycky
230db50d91 InequalityGraph::node() can create new nodes, invalidating iterators across
the set of nodes. Fix makeEqual to handle this by creating the new node first
then iterating across them second.

llvm-svn: 51573
2008-05-27 00:59:05 +00:00
Nick Lewycky
bc54ac9d10 Grammaro.
llvm-svn: 51572
2008-05-26 22:49:36 +00:00
Dan Gohman
bab18cae46 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Dan Gohman
77049e31b6 Remove unnecessary <sstream> includes.
llvm-svn: 49681
2008-04-14 20:40:47 +00:00
Chris Lattner
49e9edd6f6 Fix "Control reaches the end of non-void function" warnings,
patch by David Chisnall.

llvm-svn: 48963
2008-03-30 18:22:13 +00:00
Bill Wendling
bd1f1ae160 De-tabify.
llvm-svn: 47599
2008-02-26 10:53:30 +00:00
Dan Gohman
48d03d5a2d Add explicit keywords.
llvm-svn: 47382
2008-02-20 16:44:09 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Duncan Sands
eb464e976f Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment.  This gives a primitive type for
which getTypeSize differed from getABITypeSize.  For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).

This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition).  Instead there is:

(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type.  For a primitive type, this is the minimum number
of bits.  For an i36 this is 36 bits.  For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.

(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it).  For an
i36 this is 40 bits, for an x86 long double it is 80 bits.  This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes).  There doesn't seem to be anything
corresponding to this in gcc.

(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment.  For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS.  This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes).  This is
TYPE_SIZE in gcc.

Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize.  This means that the size of an array
is the length times the getABITypeSize.  It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize.  Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case.  So alloca's and mallocs should use getABITypeSize.  Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.

Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.

In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases).  I will get around to auditing these too at some point,
but I could do with some help.

Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize.  I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers.  If someone wants to pack these types more
tightly they can always use a packed struct.

llvm-svn: 43620
2007-11-01 20:53:16 +00:00
Nick Lewycky
3baa4cde1c Fix optimization. %x = sub %x, %y does not imply that %y is zero.
llvm-svn: 42157
2007-09-20 00:48:36 +00:00
Nick Lewycky
3ea7d43047 Oops, remove assert that wasn't meant to be committed.
llvm-svn: 41170
2007-08-18 23:21:28 +00:00
Nick Lewycky
125c9f2db3 Never insert duplicate edges.
llvm-svn: 41169
2007-08-18 23:18:03 +00:00
Nick Lewycky
4e96222245 Clean up comments, fix up some confusing code logic.
Predsimplify fails llvm-gcc bootstrap.

llvm-svn: 40815
2007-08-04 18:45:32 +00:00
Nick Lewycky
6cdd641e1d Start adding and cleaning up comments.
llvm-svn: 39894
2007-07-16 02:58:37 +00:00
Nick Lewycky
93d39c53b6 Use maximal intersection algorithm exclusively. Fixes miscompile bug.
llvm-svn: 39852
2007-07-14 04:28:04 +00:00
Nick Lewycky
ea767d42e8 Update the ValueRanges interface to use value numbers instead of Value*s.
llvm-svn: 38483
2007-07-10 03:28:21 +00:00
Nick Lewycky
c744dbdd30 Break "variable canonicalization" out of InequalityGraph and into its own class
"ValueNumbering".

llvm-svn: 37881
2007-07-05 03:15:00 +00:00
Nick Lewycky
59c02f6336 Fix value ranges.
llvm-svn: 37713
2007-06-24 20:14:22 +00:00
Nick Lewycky
c238dd7dca Remove tabs.
llvm-svn: 37710
2007-06-24 04:40:16 +00:00
Nick Lewycky
fff717bc50 Remove use of ETForest. Also cleaned up issues around unreachable basic
blocks, and optimizing within one basic block.

llvm-svn: 37709
2007-06-24 04:36:20 +00:00
Bill Wendling
d2b1274d1b Patches by Chuck Rose to unbreak V Studio builds.
Thanks Chuck!

llvm-svn: 37428
2007-06-04 23:52:59 +00:00
Devang Patel
2ef6caf14f s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
llvm-svn: 37407
2007-06-04 00:32:22 +00:00
Devang Patel
d58b82f83a s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
llvm-svn: 37403
2007-06-03 06:26:14 +00:00
Nick Lewycky
c2306ff5b4 Fix typo in comment.
llvm-svn: 36873
2007-05-06 13:37:16 +00:00
Devang Patel
cd45427a87 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
8ee9065162 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Devang Patel
38a66bc82e Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Zhou Sheng
8c150f133c Using APInt more efficiently.
llvm-svn: 36475
2007-04-26 16:42:07 +00:00
Owen Anderson
d0af582609 Undo my previous changes. Since my approach to this problem is being revised,
this approach is no longer appropriate.

llvm-svn: 36421
2007-04-25 04:18:54 +00:00
Owen Anderson
2be28af998 Make PredicateSimplifier not use DominatorTree.
llvm-svn: 36300
2007-04-21 07:38:12 +00:00
Zhou Sheng
2cb77f2d6c Make the operations of APInt variables more efficient.
llvm-svn: 36260
2007-04-19 05:35:00 +00:00
Chris Lattner
022c2bc0c3 fix long lines
llvm-svn: 36031
2007-04-14 23:32:02 +00:00
Nick Lewycky
e6cb3e2433 Add support for cast instructions.
llvm-svn: 35734
2007-04-07 15:48:32 +00:00
Nick Lewycky
3e77af40ff Support NE inequality in ValueRanges.
llvm-svn: 35724
2007-04-07 04:49:12 +00:00
Nick Lewycky
7fbec59fb4 Cleanup. Refactor out the applying of value ranges to its own method.
llvm-svn: 35719
2007-04-07 03:36:51 +00:00
Nick Lewycky
80cf96b3f8 Use TargetData to find the size of a type.
llvm-svn: 35718
2007-04-07 03:16:12 +00:00
Nick Lewycky
3ddf638983 Strengthen icmp snuggling by doing 'compare-or-equal-to' to 'compare'
first and then range testing second.

llvm-svn: 35715
2007-04-07 02:30:14 +00:00
Nick Lewycky
428523f51a Fix broken optimization disabled by a logic bug.
Analyze GEPs. If the indices are all zero, transfer whether the pointer is
known to be not null through the GEP.

Add a few more cases for xor and shift instructions.

llvm-svn: 35257
2007-03-22 02:02:51 +00:00
Nick Lewycky
2a51ea0c0e Clean up this code and fix subtract miscompile.
llvm-svn: 35146
2007-03-18 22:58:46 +00:00
Nick Lewycky
41f13d431a Propagate ValueRanges across equality.
Add some more micro-optimizations: x * 0 = 0, a - x = a --> x = 0.

llvm-svn: 35138
2007-03-18 01:09:32 +00:00
Anton Korobeynikov
b34e09291b Silence warning
llvm-svn: 35137
2007-03-17 14:48:06 +00:00
Nick Lewycky
de44438e24 Add more comments and update to new asm syntax.
Add new micro-optimizations.

Add icmp predicate snuggling. Given %x ULT 4, "icmp ugt %x, 2" becomes
"icmp eq %x, 3". This doesn't apply in any non-trivial cases yet due to missing
support for NE values in ValueRanges.

llvm-svn: 35119
2007-03-16 02:37:39 +00:00
Nick Lewycky
8a08bcfbe7 Add value ranges. Currently inefficient in both execution time and
optimization power.

llvm-svn: 35058
2007-03-10 18:12:48 +00:00
Jeff Cohen
98c99a3a02 Unbreak VC++ build.
llvm-svn: 34917
2007-03-05 00:00:42 +00:00
Nick Lewycky
a0a23a645d Translate bit operations to English.
llvm-svn: 34868
2007-03-03 03:14:40 +00:00