1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

23329 Commits

Author SHA1 Message Date
Chris Lattner
12453dd555 Other parts of this code treat noalias arguments as objects for
the purposes of escape analysis.

llvm-svn: 52302
2008-06-16 06:28:01 +00:00
Chris Lattner
e987a3bdd1 If we are checking to see if the result of a call aliases a
pointer derived from a local allocation, if the local allocation
never escapes, the pointers can't alias.  This implements PR2436

llvm-svn: 52301
2008-06-16 06:19:11 +00:00
Owen Anderson
1077c28bb1 Assign indices to empty basic blocks. This will be necessary for StrongPHIElimination in the near future.
llvm-svn: 52300
2008-06-16 06:18:41 +00:00
Chris Lattner
4e38446b34 Refactor basicaa's main alias function somethin' fierce.
This fixes several minor bugs (such as returning noalias
for comparisons between external weak functions an null) but
is mostly a cleanup.

llvm-svn: 52299
2008-06-16 06:10:11 +00:00
Chris Lattner
0b945db11c Switch from generating the int128 typedefs based on targetdata to generating
them based on the end-compiler's capabilities.  This fixes PR2453

llvm-svn: 52297
2008-06-16 04:25:29 +00:00
Chris Lattner
ac4fe3f51c Fix the crash on SimplifyLibCalls/2005-05-20-sprintf-crash.ll
llvm-svn: 52295
2008-06-16 04:10:21 +00:00
Chris Lattner
09554fd076 fix pr2460
llvm-svn: 52294
2008-06-16 04:02:40 +00:00
Duncan Sands
2dffe1cc15 The transforms in visitEXTRACT_VECTOR_ELT are
not valid if the load is volatile.  Hopefully
all wrong DAG combiner transforms of volatile
loads and stores have now been caught.

llvm-svn: 52293
2008-06-15 20:12:31 +00:00
Duncan Sands
2671518b8b LegalizeTypes support for INSERT_VECTOR_ELT with
a non-constant index.

llvm-svn: 52292
2008-06-15 20:00:14 +00:00
Wojciech Matyjewicz
58f5cc8864 Fix PR2434. When scanning for exising binary operator to reuse don't
take into account the instrucion pointed by InsertPt. Thanks to it, 
returning the new value of InsertPt to the InsertBinop() caller can be 
avoided. The bug was, actually, in visitAddRecExpr() method which wasn't 
correctly handling changes of InsertPt. There shouldn't be any 
performance regression, as -gvn pass (run after -indvars) removes any 
redundant binops.

llvm-svn: 52291
2008-06-15 19:07:39 +00:00
Wojciech Matyjewicz
0f03682725 Add a missing semicolon.
llvm-svn: 52290
2008-06-15 18:02:47 +00:00
Argyrios Kyrtzidis
6f81329b15 Fix the sys::Path::getSuffix() implementation.
llvm-svn: 52288
2008-06-15 15:15:19 +00:00
Argyrios Kyrtzidis
121cf54264 Fix the environment block that is passed to the CreateProcess function.
This bug made llvm-ld unable to function with "-native" option, since the process that was used to call 'gcc' was crashing.

llvm-svn: 52284
2008-06-15 03:54:39 +00:00
Duncan Sands
fa6e02c4dc Remove a redundant AfterLegalize check. Turn
on some code when !AfterLegalize - but since
this whole code section is turned off by an
"if (0)" it's not really turning anything on.

llvm-svn: 52276
2008-06-14 17:48:34 +00:00
Wojciech Matyjewicz
f66a7fe9de Change 'while' loop to 'do' loop.
Add a safety measure. It isn't safe to assume in ScalarEvolutionExpander that
all loops are in canonical form (but it should be safe for loops that have
AddRecs).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

llvm-svn: 52275
2008-06-14 16:48:22 +00:00
Andrew Lenharth
327c3e7559 add missing atomic intrinsic from gcc
llvm-svn: 52270
2008-06-14 05:48:15 +00:00
Chris Lattner
f9d43c9853 Fix a case where tailcallelim wouldn't set the changed bit when it made a change.
llvm-svn: 52267
2008-06-14 00:49:48 +00:00
Evan Cheng
2e99c9cbf8 Teach the spiller to commute instructions in order to fold a reload. This hits 410 times on 444.namd and 122 times on 252.eon.
llvm-svn: 52266
2008-06-13 23:58:02 +00:00
Eli Friedman
11d4c94933 Don't skip over instructions other than loads that might read memory
when trying to sink stores.

llvm-svn: 52259
2008-06-13 22:02:12 +00:00
Dan Gohman
7f1fcc4339 Protect ChangeCompareStride from situations in which it is possible
for it to generate use-before-def IR, such as in this testcase.

llvm-svn: 52258
2008-06-13 21:43:41 +00:00
Eli Friedman
d38a639deb Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the
structure checks are incorrect if the blocks aren't distinct.
Fixes PR2435.

llvm-svn: 52257
2008-06-13 21:17:49 +00:00
Duncan Sands
40c8db881a Disable some DAG combiner optimizations that may be
wrong for volatile loads and stores.  In fact this
is almost all of them!  There are three types of
problems: (1) it is wrong to change the width of
a volatile memory access.  These may be used to
do memory mapped i/o, in which case a load can have
an effect even if the result is not used.  Consider
loading an i32 but only using the lower 8 bits.  It
is wrong to change this into a load of an i8, because
you are no longer tickling the other three bytes.  It
is also unwise to make a load/store wider.  For
example, changing an i16 load into an i32 load is
wrong no matter how aligned things are, since the
fact of loading an additional 2 bytes can have
i/o side-effects.  (2) it is wrong to change the
number of volatile load/stores: they may be counted
by the hardware.  (3) it is wrong to change a volatile
load/store that requires one memory access into one
that requires several.  For example on x86-32, you
can store a double in one processor operation, but to
store an i64 requires two (two i32 stores).  In a
multi-threaded program you may want to bitcast an i64
to a double and store as a double because that will
occur atomically, and be indivisible to other threads.
So it would be wrong to convert the store-of-double
into a store of an i64, because this will become two
i32 stores - no longer atomic.  My policy here is
to say that the number of processor operations for
an illegal operation is undefined.  So it is alright
to change a store of an i64 (requires at least two
stores; but could be validly lowered to memcpy for
example) into a store of double (one processor op).
In short, if the new store is legal and has the same
size then I say that the transform is ok.  It would
also be possible to say that transforms are always
ok if before they were illegal, whether after they
are illegal or not, but that's more awkward to do
and I doubt it buys us anything much.
However this exposed an interesting thing - on x86-32
a store of i64 is considered legal!  That is because
operations are marked legal by default, regardless of
whether the type is legal or not.  In some ways this
is clever: before type legalization this means that
operations on illegal types are considered legal;
after type legalization there are no illegal types
so now operations are only legal if they really are.
But I consider this to be too cunning for mere mortals.
Better to do things explicitly by testing AfterLegalize.
So I have changed things so that operations with illegal
types are considered illegal - indeed they can never
map to a machine operation.  However this means that
the DAG combiner is more conservative because before
it was "accidentally" performing transforms where the
type was illegal because the operation was nonetheless
marked legal.  So in a few such places I added a check
on AfterLegalize, which I suppose was actually just
forgotten before.  This causes the DAG combiner to do
slightly more than it used to, which resulted in the X86
backend blowing up because it got a slightly surprising
node it wasn't expecting, so I tweaked it.

llvm-svn: 52254
2008-06-13 19:07:40 +00:00
Wojciech Matyjewicz
d3d353dd68 Use recently added getTruncateOrZeroExtend method to make the code shorter.
llvm-svn: 52251
2008-06-13 17:02:03 +00:00
Nick Lewycky
0aa53f2b52 Crash less. The i64 restriction in BinomialCoefficient caused some problems
with code that was expecting different bit widths for different values.

Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.

llvm-svn: 52248
2008-06-13 04:38:55 +00:00
Gabor Greif
10de8c6c59 fix a minor deviation from the original in my previous commit
llvm-svn: 52247
2008-06-12 21:51:29 +00:00
Gabor Greif
509b3a75f4 op_iterator-ify some loops, low hanging fruit only, there is more
llvm-svn: 52246
2008-06-12 21:37:33 +00:00
Evan Cheng
5897328890 Do not speculatively execute an instruction by hoisting it to its predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block.
llvm-svn: 52244
2008-06-12 21:15:59 +00:00
Evan Cheng
b0d847cf05 Revert 52223.
llvm-svn: 52243
2008-06-12 20:55:39 +00:00
Owen Anderson
22a982f9eb Switch GVN to use ScopedHashTable.
llvm-svn: 52242
2008-06-12 19:25:32 +00:00
Matthijs Kooijman
43eae10af6 Fix redirection of stderr in sys::Program::ExecuteAndWait. There was logic
error that caused it to redirect stderr to stdout too often.

This fix is applied identically to the win32 code as well, but that is
untested.
--Thi line, and those below, will be ignored--

M    System/Unix/Program.inc
M    System/Win32/Program.inc

llvm-svn: 52233
2008-06-12 12:53:35 +00:00
Matthijs Kooijman
f2d854e34b Make I/O redirection handling in sys::Program a bit more consistent. No
functional changes. Win32 code is untested, but should work fine.

In the unix variant, rename RedirectFD to RedirectIO and let that function
handle empty and null paths instead of doing that in the caller 3 times. This
is the same as win32 already does it.

In the win32 variant, use Path::isEmpty() instead of checking the resulting
c_str() manually. This is the same as unix already does it.

llvm-svn: 52230
2008-06-12 10:47:18 +00:00
Gabor Greif
a90427821b op_iterator-ify some loops, fix 80col violations
llvm-svn: 52226
2008-06-11 21:38:51 +00:00
Anton Korobeynikov
74422b3cd0 Properly lower DYNAMIC_STACKALLOC - bracket all black magic with
CALLSEQ_BEGIN & CALLSEQ_END.

llvm-svn: 52225
2008-06-11 20:16:42 +00:00
Evan Cheng
7b7a321f64 For now, avoid generating FP select instructions in order to speculatively execute integer arithmetic instructions. FP selects are more likely to be expensive (even compared to branch on fcmp). This is not a wonderful solution but I rather err on the side of conservative.
This fixes the heapsort performance regressions.

llvm-svn: 52224
2008-06-11 19:18:20 +00:00
Evan Cheng
9b0c0a0f00 Avoid duplicating loop header which leads to unnatural loops (and just seem like general badness to me, likely to cause code explosion).
Patch by Florian Brandner.

llvm-svn: 52223
2008-06-11 19:07:54 +00:00
Matthijs Kooijman
0f9df32e12 Teach instruction combining about the extractvalue. It can succesfully fold
useless insert-extract chains, similar to how it folds them for vectors.

Add a testcase for this.

llvm-svn: 52217
2008-06-11 14:05:05 +00:00
Duncan Sands
2a9c84481c Sometimes (rarely) nodes held in LegalizeTypes
maps can be deleted.  This happens when RAUW
replaces a node N with another equivalent node
E, deleting the first node.  Solve this by
adding (N, E) to ReplacedNodes, which is already
used to remap nodes to replacements.  This means
that deleted nodes are being allowed in maps,
which can be delicate: the memory may be reused
for a new node which might get confused with the
old deleted node pointer hanging around in the
maps, so detect this and flush out maps if it
occurs (ExpungeNode).  The expunging operation
is expensive, however it never occurs during
a llvm-gcc bootstrap or anywhere in the nightly
testsuite.  It occurs three times in "make check":
Alpha/illegal-element-type.ll,
PowerPC/illegal-element-type.ll and
X86/mmx-shift.ll.  If expunging proves to be too
expensive then there are other more complicated
ways of solving the problem.
In the normal case this patch adds the overhead
of a few more map lookups, which is hopefully
negligable.

llvm-svn: 52214
2008-06-11 11:42:12 +00:00
Gordon Henriksen
22f7a6eb91 Better test for availability of __gnu_cxx::stdio_filebuf.
If this doesn't work, I'll write a configure test.

llvm-svn: 52213
2008-06-11 10:46:24 +00:00
Matthijs Kooijman
511d6a5cd3 Clarify a comment.
llvm-svn: 52212
2008-06-11 09:00:12 +00:00
Gabor Greif
519129edc8 op_iterator-ify loops
llvm-svn: 52191
2008-06-10 22:03:26 +00:00
Dan Gohman
c87fbbd014 Teach isGAPlusOffset to respect a GlobalAddressSDNode's offset
value, which is something that apparently isn't used much.

llvm-svn: 52158
2008-06-09 22:05:52 +00:00
Dan Gohman
68f8fbdac4 Re-apply 52002, allowing the verifier to accept non-MRV struct return
types on functions, with adjustments so that it accepts both
new-style aggregate returns and old-style MRV returns, including those
with only a single member.

llvm-svn: 52157
2008-06-09 21:26:13 +00:00
Dan Gohman
8c089d4df6 CodeGen support for aggregate-value function arguments.
llvm-svn: 52156
2008-06-09 21:19:23 +00:00
Duncan Sands
e46308480d Various tweaks related to apint codegen. No functionality
change for non-funky-sized integers.

llvm-svn: 52151
2008-06-09 15:48:25 +00:00
Dan Gohman
d789392934 Handle empty aggregate values.
llvm-svn: 52150
2008-06-09 15:21:47 +00:00
Dan Gohman
7c97681798 AsmParser support for immediate constant aggregate values.
llvm-svn: 52149
2008-06-09 14:45:02 +00:00
Dan Gohman
ce662293ed CPPBackend support for extractvalue and insertvalue.
llvm-svn: 52147
2008-06-09 14:12:10 +00:00
Dan Gohman
ee7b8797d0 Abort on an unrecognized opcode.
llvm-svn: 52146
2008-06-09 14:09:13 +00:00
Dan Gohman
5f7b94fd7b Update the CPP backend for the ConstantFP::get API change.
llvm-svn: 52144
2008-06-09 14:08:11 +00:00
Duncan Sands
a487df7710 Remove some DAG combiner assumptions about sizes
of integer types.  Fix the isMask APInt method to
actually work (hopefully) rather than crashing
because it adds apints of different bitwidths.
It looks like isShiftedMask is also broken, but
I'm leaving that one to the APInt people (it is
not used anywhere).

llvm-svn: 52142
2008-06-09 11:32:28 +00:00