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

23512 Commits

Author SHA1 Message Date
Evan Cheng
89e2e3292d Rather than avoiding to wrap ISD::DECLARE GV operand in X86ISD::Wrapper, simply handle it at dagisel time with x86 specific isel code.
llvm-svn: 52377
2008-06-17 02:01:22 +00:00
Chris Lattner
468adb09d7 Add a missing ~ (dtor became ctor) which caused crashes on a bunch of stuff.
llvm-svn: 52374
2008-06-16 23:06:51 +00:00
Evan Cheng
8cfd1d39a1 Do not issue identity copies.
llvm-svn: 52373
2008-06-16 22:52:53 +00:00
Dan Gohman
c1fd5f170b Refine the change in r52258 for avoiding use-before-def conditions
when changing the stride of a comparison so that it's slightly
more precise, by having it scan the instruction list to determine
if there is a use of the condition after the point where the
condition will be inserted.

llvm-svn: 52371
2008-06-16 22:34:15 +00:00
Chris Lattner
dd707dc82d switch TypeHasCycleThroughItself from using an std::set to using a SmallPtrSet,
this speeds up the linking testcase in PR1860 by 44% (.379 -> 0.263)

llvm-svn: 52365
2008-06-16 21:20:58 +00:00
Chris Lattner
6782f56054 stop making PATypeHolder's so crazily.
llvm-svn: 52364
2008-06-16 21:17:12 +00:00
Evan Cheng
4e7b7b21a2 Horizontal-add instructions are not commutative.
llvm-svn: 52363
2008-06-16 21:16:24 +00:00
Evan Cheng
7b87eb0128 Switch over to SetVector to ensure same order of iterations do not vary across runs.
llvm-svn: 52361
2008-06-16 21:08:17 +00:00
Chris Lattner
3dfc439a87 use a real associative container for type association instead of using
a vector with a linear search.  This speeds up the linking testcase 
in PR1860 from 0.965s to 0.385s on my system.

llvm-svn: 52357
2008-06-16 21:00:18 +00:00
Evan Cheng
acd614c262 mpsadbw is commutable.
llvm-svn: 52352
2008-06-16 20:25:59 +00:00
Chris Lattner
f87729aa1f bail out sooner if we have two concrete but different types.
llvm-svn: 52351
2008-06-16 20:03:01 +00:00
Chris Lattner
896c38c96a simplify some code.
llvm-svn: 52350
2008-06-16 19:55:40 +00:00
Chris Lattner
fe3ddf06a8 Apply a patch from Nathan Keynes, which speeds up llvm-link on
the testcases in PR1860 from taking more than 1 hour (when I killed it)
to taking 1s.

llvm-svn: 52347
2008-06-16 19:48:08 +00:00
Owen Anderson
63a604a316 Remove special case handling of empty MBBs now that we assign indices to them.
llvm-svn: 52345
2008-06-16 19:32:40 +00:00
Chris Lattner
1a604edf16 handle vectors. Any integers that got here would necessarily be different already.
llvm-svn: 52341
2008-06-16 18:27:53 +00:00
Chris Lattner
c24aba4724 Simplify ResolveTypes by pulling the null case out into the one
client that cares and simplifying its control flow.

Remove the DestST argument to ResolveTypes and RecursiveResolveTypes*
which are dead now.

llvm-svn: 52340
2008-06-16 18:19:05 +00:00
Evan Cheng
6c6518787b Iterating over SmallPtrSet is not deterministic.
llvm-svn: 52339
2008-06-16 18:17:09 +00:00
Chris Lattner
cebf7d79b3 simplify RecursiveResolveTypes and ResolveTypes by pulling the naming out of
ResolveTypes into the one place that needs it.

llvm-svn: 52338
2008-06-16 18:11:40 +00:00
Chris Lattner
b2c9317b8d Add a new flag that disables symbol lookup with dlsym when set. This allows
a JIT client to completely control symbol lookup with the LazyFunctionCreator
interface.

llvm-svn: 52335
2008-06-16 17:44:14 +00:00
Chris Lattner
ddfa0590ae Add support for icache invalidation on non-darwin ppc systems.
Patch by Gary Benson!

llvm-svn: 52332
2008-06-16 17:04:06 +00:00
Owen Anderson
3c4bb80d78 Re-enable empty block indexing by default, since it doesn't seem to have any
impact on code quality or compile time.

llvm-svn: 52329
2008-06-16 16:58:24 +00:00
Matthijs Kooijman
2ba9a750dd Make BuildSubAggregate use FindInsertedElement again to prevent it from
inserting extractvalues. In particular, this prevents the insertion of
extractvalues that can't be folded away later. Also add an example of when this
stuff is needed.

llvm-svn: 52328
2008-06-16 14:13:46 +00:00
Matthijs Kooijman
544c9b2fb0 Make the InsertBefore argument to FindInsertedValue optional, so you can find an inserted value without modifying the code.
llvm-svn: 52319
2008-06-16 13:28:31 +00:00
Matthijs Kooijman
238b1e8d69 Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.
llvm-svn: 52318
2008-06-16 13:13:08 +00:00
Matthijs Kooijman
dedcf00fcc 80 column fixes.
llvm-svn: 52316
2008-06-16 12:57:37 +00:00
Matthijs Kooijman
1dd7d9cdc1 Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. While
I'm at it, rename it to FindInsertedValue.

The only functional change is that newly created instructions are no longer
added to instcombine's worklist, but that is not really necessary anyway (and
I'll commit some improvements next that will completely remove the need).

llvm-svn: 52315
2008-06-16 12:48:21 +00:00
Argyrios Kyrtzidis
65f671fd74 Minor comment fix.
llvm-svn: 52312
2008-06-16 10:14:09 +00:00
Duncan Sands
78bdcc813e Allow these transforms for types like i256 while
still excluding types like i1 (not byte sized)
and i120 (loading an i120 requires loading an i64,
an i32, an i16 and an i8, which is expensive). 

llvm-svn: 52310
2008-06-16 08:14:38 +00:00
Evan Cheng
93d91a771c Fix read after free found by valgrind.
llvm-svn: 52309
2008-06-16 07:34:17 +00:00
Evan Cheng
2dfe8c2435 Add option to commuteInstruction() which forces it to create a new (commuted) instruction.
llvm-svn: 52308
2008-06-16 07:33:11 +00:00
Owen Anderson
114ce854d1 Make indexing empty basic blocks an option for the moment.
llvm-svn: 52306
2008-06-16 07:10:49 +00:00
Chris Lattner
0bc9e4aa8f simplify some code by using a helper function. This really really
wants a 'nocapture' predicate.

llvm-svn: 52304
2008-06-16 06:38:26 +00:00
Chris Lattner
35be1f6c83 move a bunch of predicates up into their own section
in this file, no other changes.

llvm-svn: 52303
2008-06-16 06:30:22 +00:00
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
Rafael Espindola
feaadb1e05 add support for PIC on linux x86-64
llvm-svn: 52139
2008-06-09 09:52:31 +00:00
Chris Lattner
806f0a8411 lower calls to abs to inline code, PR2337
llvm-svn: 52138
2008-06-09 08:26:51 +00:00
Chris Lattner
7864575654 Fix PR2411, where ip constant prop would propagate the
result of a weak function.

llvm-svn: 52137
2008-06-09 07:58:07 +00:00
Chris Lattner
96dec66124 use 'continue' to make the function linker simpler. When linking a strong
function into a weak function, zap the weak function body so that the
strong one overrides it.  This fixes PR2410

llvm-svn: 52135
2008-06-09 07:47:34 +00:00
Chris Lattner
4c99f72771 minor changes to short circuit the 'no linkage' case earlier for
function bodies.  We now don't try to unify types or handling type
mismatches if when linking an internal foo to an external foo.

llvm-svn: 52134
2008-06-09 07:36:11 +00:00
Chris Lattner
744e896c06 simplify function visibility handling.
llvm-svn: 52133
2008-06-09 07:25:28 +00:00
Duncan Sands
fe2a970a5c Remove comparison methods for MVT. The main cause
of apint codegen failure is the DAG combiner doing
the wrong thing because it was comparing MVT's using
< rather than comparing the number of bits.  Removing
the < method makes this mistake impossible to commit.
Instead, add helper methods for comparing bits and use
them.

llvm-svn: 52098
2008-06-08 20:54:56 +00:00
Chris Lattner
4a896996cb Limit the icmp+phi merging optimization to the cases where it is profitable:
don't make i1 phis when it won't be possible to eliminate them.

llvm-svn: 52097
2008-06-08 20:52:11 +00:00
Bruno Cardoso Lopes
c91758a7fc Added FP instruction formats.
llvm-svn: 52086
2008-06-08 01:39:36 +00:00
Bill Wendling
346669b97f Temporarily reverting r52056. It's causing PPC to fail to bootstrap.
llvm-svn: 52085
2008-06-08 01:36:24 +00:00
Bruno Cardoso Lopes
b0cb678a47 Added support for FP Registers
llvm-svn: 52079
2008-06-07 21:32:41 +00:00
Evan Cheng
c7ed1b9258 Speculatively execute a block when the the block is the then part of a triangle shape and it contains a single, side effect free, cheap instruction. The branch is eliminated by adding a select instruction. i.e.
Turn                                                                                                                                                                                                       
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    br i1 %t1, label %BB1, label %BB2                                                                                                                                                                      
BB1:                                                                                                                                                                                                       
    %t3 = add %t2, c                                                                                                                                                                                       
    br label BB2                                                                                                                                                                                           
BB2:                                                                                                                                                                                                       
=>                                                                                                                                                                                                         
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    %t4 = add %t2, c                                                                                                                                                                                       
    %t3 = select i1 %t1, %t2, %t3

llvm-svn: 52073
2008-06-07 08:52:29 +00:00
Evan Cheng
6b5b097805 Revert r52046. It broke cbe on x86 / Mac OS X.
llvm-svn: 52071
2008-06-07 07:50:29 +00:00
Dan Gohman
d4e2736532 CodeGen support for insertvalue and extractvalue, and for loads and
stores of aggregate values.

llvm-svn: 52069
2008-06-07 02:02:36 +00:00
Owen Anderson
a18629b9c6 Connect successors before creating the DAG node for the branch. This has
no visible functionality change, but enables a future patch where node creation
will update the CFG if it decides to create an unconditional rather than a conditional branch.

llvm-svn: 52067
2008-06-07 00:00:23 +00:00
Gabor Greif
7c2e365dbc get rid of ExtractValueInst::init's Value argument, it is already passed to the UnaryInstruction ctor
llvm-svn: 52064
2008-06-06 21:06:32 +00:00
Evan Cheng
b19baf81ba Typo.
llvm-svn: 52062
2008-06-06 21:00:10 +00:00
Gabor Greif
8ac103e71d make ExtractValueInst derived from UnaryInstruction
llvm-svn: 52061
2008-06-06 20:28:12 +00:00
Evan Cheng
d919d1ecd8 Enable stack coloring by default.
llvm-svn: 52057
2008-06-06 19:52:44 +00:00
Evan Cheng
3ac5c6575a PPC preferred loop alignment is 16.
llvm-svn: 52056
2008-06-06 19:50:46 +00:00
Devang Patel
523ef2c2ea LoopSimplify preserves AA.
llvm-svn: 52053
2008-06-06 17:50:58 +00:00
Devang Patel
1db00c242e Print debug message only if there are dead passes.
llvm-svn: 52052
2008-06-06 17:50:36 +00:00
Anton Korobeynikov
8c40a176f7 Handle assembler identifiers specially in CBE. This fixes PR2418.
llvm-svn: 52046
2008-06-06 16:08:26 +00:00
Duncan Sands
c19b5155ea Tighten up the abstraction slightly.
llvm-svn: 52045
2008-06-06 12:49:32 +00:00
Duncan Sands
d634afe3aa Wrap MVT::ValueType in a struct to get type safety
and better control the abstraction.  Rename the type
to MVT.  To update out-of-tree patches, the main
thing to do is to rename MVT::ValueType to MVT, and
rewrite expressions like MVT::getSizeInBits(VT) in
the form VT.getSizeInBits().  Use VT.getSimpleVT()
to extract a MVT::SimpleValueType for use in switch
statements (you will get an assert failure if VT is
an extended value type - these shouldn't exist after
type legalization).
This results in a small speedup of codegen and no
new testsuite failures (x86-64 linux).

llvm-svn: 52044
2008-06-06 12:08:01 +00:00
Zhou Sheng
06fc769e52 As Chris suggested, handle the situation if ShAmt larger than BitWidth,
otherwise, opt might crash.

llvm-svn: 52041
2008-06-06 08:32:05 +00:00
Evan Cheng
fe06a1fd5b Refine stack slot interval weight computation.
llvm-svn: 52040
2008-06-06 07:54:39 +00:00
Anton Korobeynikov
b207a716ee Turn stdout into binary mode during bitcode emission.
This is necessary on windows targets, since stdout is in text mode there.
Patch by Julien Lerouge!

llvm-svn: 52038
2008-06-06 07:24:01 +00:00
Anton Korobeynikov
3e9eeaf6c9 Provide hooks for libgcc symbols' address resolution inside lli on mingw32.
Patch by Julien Lerouge!

llvm-svn: 52037
2008-06-06 07:20:07 +00:00
Bruno Cardoso Lopes
23e9cfc581 Added custom isel for MUL, SDIVREM, UDIVREM, SMUL_LOHI and UMUL_LOHI nodes
MUL is not anymore directly matched because its a pseudoinstruction.
LogicI class fixed to zero-extend immediates. 

llvm-svn: 52036
2008-06-06 06:37:31 +00:00
Bruno Cardoso Lopes
7b58f690cb Added custom SELECT_CC lowering
Added special isel for ADDE,SUBE and new patterns to match SUBC,ADDC

llvm-svn: 52031
2008-06-06 00:58:26 +00:00
Dan Gohman
70fe9e347d Revert 52002.
llvm-svn: 52030
2008-06-05 23:57:06 +00:00
Chris Lattner
67a5a4eba8 Expose a public interface to this pass.
llvm-svn: 52029
2008-06-05 23:45:18 +00:00
Chris Lattner
ea07bf8c1b Let libcall semantics decide whether it knows about functions
with definitions or not.

llvm-svn: 52028
2008-06-05 23:38:34 +00:00
Evan Cheng
badbe3e3fa Don't break strict aliasing.
llvm-svn: 52026
2008-06-05 22:59:21 +00:00
Owen Anderson
6b49b2db48 Remove debugging code.
llvm-svn: 52016
2008-06-05 18:43:34 +00:00
Owen Anderson
18ca5de680 Use the newly created helper on LiveIntervals.
llvm-svn: 52013
2008-06-05 17:22:53 +00:00
Owen Anderson
08c0c02c20 Add a helper for constructing new live ranges that ended from an instruction to the end of its MBB.
llvm-svn: 52012
2008-06-05 17:15:43 +00:00
Zhou Sheng
eaa93efd52 If BitWidth equals to ShtAmt, the RHSKnownZero[BitWidth-ShiftAmt-1] will
crash the opt. Just fix this.

Test case in llvm/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll

llvm-svn: 52003
2008-06-05 14:23:44 +00:00
Matthijs Kooijman
ebf00c0f65 Change the Verifier to support returning first class aggregrates.
Add a testcase for functions returning first class aggregrates.

llvm-svn: 52002
2008-06-05 14:00:36 +00:00
Zhou Sheng
0d32cd97e1 As comments said, for negative value, the arithmetic
over-shift-right should return -1. So here it should be signed-extended,
when bitwidth larger than 64.

test case: llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll

llvm-svn: 51999
2008-06-05 13:27:38 +00:00
Matthijs Kooijman
6e1c286f53 Learn ScalarReplAggregrates how stores and loads of first class aggregrates
work and how to replace them into individual values. Also, when trying to
replace an aggregrate that is used by load or store with a single (large)
integer, don't crash (but don't replace the aggregrate either).

Also adds a testcase for both structs and arrays.

llvm-svn: 51997
2008-06-05 12:51:53 +00:00
Matthijs Kooijman
775c91b2f5 Let StructRetPromotion check if all if its users are really calls or invokesn,
not other instructions. This fixes a crash with the added testcase.

llvm-svn: 51992
2008-06-05 08:57:20 +00:00
Matthijs Kooijman
df97b7b4a2 Let StructRetPromotion check if it's users are really calling it and not
passing its pointer. Fixes test with added testcase.

llvm-svn: 51991
2008-06-05 08:48:32 +00:00
Matthijs Kooijman
8e980a31d5 Use use_iterator::getOperandNo instead of CallSite::hasArgument to check if a
function is passed as an argument instead of called. Also do this check a bit
earlier.

llvm-svn: 51990
2008-06-05 08:34:25 +00:00
Matthijs Kooijman
6216df14cb * Make CallSite::hasArgument const and let it take a const parameter.
llvm-svn: 51989
2008-06-05 08:04:58 +00:00
Matthijs Kooijman
1fd76cd396 Update comments and documentation to reflect that GCSE and ValueNumbering are
deprecated by the GVN and GVNPRE passes.

llvm-svn: 51983
2008-06-05 07:55:49 +00:00
Evan Cheng
e77d6a1a2d Fix a memcpy lowering bug. Even though the memcpy alignment is smaller than the desired alignment, the frame destination alignment may still be larger than the desired alignment. Don't change its alignment to something smaller.
llvm-svn: 51970
2008-06-04 23:37:54 +00:00
Owen Anderson
264b60b69d Remove unneeded #include.
llvm-svn: 51955
2008-06-04 18:28:10 +00:00
Evan Cheng
a9cf0ff766 Oops. Should not be enabled by default.
llvm-svn: 51953
2008-06-04 18:09:20 +00:00
Chris Lattner
7e3db1af97 Rewrite a bunch of the CBE's inline asm code, giving it the
ability to handle indirect input operands.  This fixes PR2407.

llvm-svn: 51952
2008-06-04 18:03:28 +00:00
Owen Anderson
503cf18547 Correctly construct live intervals for the copies we inserted into the predecessors of a block containing a PHI.
llvm-svn: 51950
2008-06-04 17:55:58 +00:00
Evan Cheng
9048a25037 Revert this.
llvm-svn: 51949
2008-06-04 17:21:44 +00:00
Matthijs Kooijman
a03f85df05 Replace two manual loops with calls to CallSite::hasArguments (no functional changes).
llvm-svn: 51947
2008-06-04 16:57:50 +00:00
Matthijs Kooijman
de47a7518d Add CallSite::hasArgument to allow for seeing if a call passes a certain value as an argument quickly.
llvm-svn: 51946
2008-06-04 16:31:12 +00:00
Matthijs Kooijman
318e1df0e4 Add a Name parameter to two of the init methods of GetElementPointer to make the name setting more consistent.
llvm-svn: 51945
2008-06-04 16:14:12 +00:00
Matthijs Kooijman
2f6b694afc Implement the two constructors in InsertValueInst and ExtractValueInst.
Add a Name argment to two init methods in these classes as well to make things
a bit more consistent.

llvm-svn: 51937
2008-06-04 14:40:55 +00:00
Evan Cheng
2fc7954878 Add a stack slot coloring pass. Not yet enabled.
llvm-svn: 51934
2008-06-04 09:18:41 +00:00
Evan Cheng
7504610c97 LowerSubregs should not clobber any analysis.
llvm-svn: 51933
2008-06-04 09:17:16 +00:00
Evan Cheng
9153a5316c Move #include to right place.
llvm-svn: 51932
2008-06-04 09:16:33 +00:00
Evan Cheng
523ad8a09a Register if-converter pass for -debug-pass.
llvm-svn: 51931
2008-06-04 09:15:51 +00:00
Evan Cheng
20d22b220a More pass manager debugging outputs.
llvm-svn: 51930
2008-06-04 09:13:31 +00:00
Duncan Sands
5a6c6a92c1 Change packed struct layout so that field sizes
are the same as in unpacked structs, only field
positions differ.  This only matters for structs
containing x86 long double or an apint; it may
cause backwards compatibility problems if someone
has bitcode containing a packed struct with a
field of one of those types.
The issue is that only 10 bytes are needed to
hold an x86 long double: the store size is 10
bytes, but the ABI size is 12 or 16 bytes (linux/
darwin) which comes from rounding the store size
up by the alignment.  Because it seemed silly not
to pack an x86 long double into 10 bytes in a
packed struct, this is what was done.  I now
think this was a mistake.  Reserving the ABI size
for an x86 long double field even in a packed
struct makes things more uniform: the ABI size is
now always used when reserving space for a type.
This means that developers are less likely to
make mistakes.  It also makes life easier for the
CBE which otherwise could not represent all LLVM
packed structs (PR2402).
Front-end people might need to adjust the way
they create LLVM structs - see following change
to llvm-gcc.

llvm-svn: 51928
2008-06-04 08:21:45 +00:00
Chris Lattner
5839247e92 Add #includes required by GCC 4.3, thanks for Zhongxing Xu
for reporting this.

llvm-svn: 51926
2008-06-04 04:46:14 +00:00
Bruno Cardoso Lopes
5a4d1d0fd3 Some Mips minor fixes
Added support for mips little endian arch => mipsel

llvm-svn: 51923
2008-06-04 01:45:25 +00:00
Owen Anderson
f9c76de0bb We need to subtract one from this index because live ranges are open at the end.
llvm-svn: 51922
2008-06-04 00:38:56 +00:00
Scott Michel
38dc44ecab Fix spellnig error
llvm-svn: 51917
2008-06-03 19:13:20 +00:00
Owen Anderson
2a072a6923 LoopIndexSplit can sometimes result in cases where a block in its own domfrontier.
Don't crash when we encounter one of these.

llvm-svn: 51915
2008-06-03 18:29:48 +00:00
Dale Johannesen
2803c991a5 Prevent a crash in debug dumps.
llvm-svn: 51910
2008-06-03 18:14:29 +00:00
Dale Johannesen
c0cd6cd4d4 Add StringConstantPrefix to control what the
assembler names of string constants look like.

llvm-svn: 51909
2008-06-03 18:09:06 +00:00
Scott Michel
0acfa8cc1d Find a better place to output hex constants corresponding to integers.
llvm-svn: 51904
2008-06-03 15:39:51 +00:00
Bruno Cardoso Lopes
dbf310acbc Fixed bug in bad behavior in calculateFrameObjectOffsets,
the solution commited is different from the previous patch to
avoid int and unsigned comparison

llvm-svn: 51899
2008-06-03 08:46:59 +00:00
Evan Cheng
cbb64ece8a Do not run loop-aligner at -fast (e.g. -O0).
llvm-svn: 51898
2008-06-03 06:56:08 +00:00
Scott Michel
5c7e594b97 Revert this patch
llvm-svn: 51897
2008-06-03 06:18:19 +00:00
Devang Patel
edc62adcd9 "Unable to schedule <A> required by <B>" is more helpful then
"Unable to handle Pass that requires lower level Analysis pass"

llvm-svn: 51892
2008-06-03 01:20:02 +00:00
Devang Patel
390d72740e Add debugging aid.
llvm-svn: 51891
2008-06-03 01:02:16 +00:00
Dan Gohman
5c60e1fdff Fix whitespace in whitespace-significant pseudocode in a comment.
llvm-svn: 51890
2008-06-03 00:57:21 +00:00
Dan Gohman
fbf0f6cf8e Constant folding for insertvalue and extractvalue.
llvm-svn: 51889
2008-06-03 00:15:20 +00:00
Devang Patel
b1798d2be0 Update dom tree. Fix PR 2372.
llvm-svn: 51887
2008-06-02 22:52:56 +00:00
Dan Gohman
626f8e4454 Fold adds and subtracts of zero immediately, instead of waiting
for dagcombine to do this.

llvm-svn: 51886
2008-06-02 22:27:05 +00:00
Scott Michel
3918ece044 Minor cosmetic patch so that the hex equivalent of a decimal
constant shows up in the assembly language output. Helps with
debugging without a HP calculator having to be handy.

llvm-svn: 51885
2008-06-02 22:19:12 +00:00
Scott Michel
5323d58281 Add necessary 64-bit support so that gcc frontend compiles (mostly). Current
issue is operand promotion for setcc/select... but looks like the fundamental
stuff is implemented for CellSPU.

llvm-svn: 51884
2008-06-02 22:18:03 +00:00
Dan Gohman
5a9c2a3434 Implement CBE support for first-class structs and array values,
and insertvalue and extractvalue instructions.

First-class array values are not trivial because C doesn't
support them. The approach I took here is to wrap all arrays
in structs. Feedback is welcome.

The 2007-01-15-NamedArrayType.ll test needed to be modified
because it has a "not grep" for a string that now exists,
because array types now have associated struct types, and
those struct types have names.

llvm-svn: 51881
2008-06-02 21:30:49 +00:00
Chris Lattner
3e1cd5c9bf Remove unneeded code I added.
llvm-svn: 51878
2008-06-02 18:39:07 +00:00
Owen Anderson
54660d1fcf Correctly handle removed instructions at the beginning of MBBs when renumbering.
llvm-svn: 51876
2008-06-02 17:36:36 +00:00
Wojciech Matyjewicz
06e4c8a420 Fixes PR2395. Looking for a constant in a GEP tail (when the first GEP
is longer than the second one) should stop after finding one. Added break 
instruction guarantees it. It also changes difference between offsets to 
absolute value of this difference in the condition.

llvm-svn: 51875
2008-06-02 17:26:12 +00:00
Rafael Espindola
feec40a71f Don't use the GOT for symbols that are not externally visible.
llvm-svn: 51865
2008-06-02 07:52:43 +00:00
Chris Lattner
ea60f0ccc3 move CannotBeNegativeZero to ValueTracking. Simplify some signbit comparisons.
llvm-svn: 51864
2008-06-02 01:29:46 +00:00
Chris Lattner
4960857273 move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBits
out of instcombine into a new file in libanalysis.  This also teaches
ComputeNumSignBits about the number of sign bits in a constantint.

llvm-svn: 51863
2008-06-02 01:18:21 +00:00
Owen Anderson
7700de3137 Fix two issues that Eli Friedman pointed out, where would misoptimized code like:
char a[200];
init(a, a+200);

OR

int a[200];
char* b = (char*)a;
char* c = (char*)a;
foo(b, c);

llvm-svn: 51850
2008-06-01 22:26:26 +00:00
Owen Anderson
00e422b2ea Don't remove the memcpy when call slot substitution fails.
llvm-svn: 51848
2008-06-01 21:52:16 +00:00
Owen Anderson
ee111c28b8 Remember to update the reverse non-local cache when cleaning up dirty entries. This fixes PR2397.
llvm-svn: 51846
2008-06-01 21:03:52 +00:00
Owen Anderson
67a1d5ec35 Make ping more aggressive in finding nonlocal caching errors.
llvm-svn: 51845
2008-06-01 20:51:41 +00:00
Duncan Sands
d14212a3e1 When simplifying a call to a bitcast function, tighten up
the conditions for performing the transform when only the
function declaration is available: no longer allow turning
i32 into i64 for example.  Only allow changing between
pointer types, and between pointer types and integers of
the same size.  For return values ptr -> intptr was already
allowed; I added ptr -> ptr and intptr -> ptr while there.
As shown by a recent objc testcase, changing the way
parameters/return values are passed can be fatal when calling
code written in assembler that directly manipulates call
arguments and return values unless the transform has no
impact on the way they are passed at the codegen level.
While it is possible to imagine an ABI that treats integers
of pointer size differently to pointers, I don't think LLVM
supports any so the transform should now be safe while still
being useful.

llvm-svn: 51834
2008-06-01 07:38:42 +00:00
Bruno Cardoso Lopes
e5b4a0d794 Fixed flag issue that was generating infinite loop while in list scheduling.
llvm-svn: 51833
2008-06-01 03:49:39 +00:00
Dan Gohman
06d49b3c5b AsmWriter support for insertvalue/extractvalue. These instructions can
now round-trip through assembly and bitcode.

llvm-svn: 51823
2008-05-31 19:12:39 +00:00
Dan Gohman
1e195a735e Improved bitcode support for insertvalue/extractvalue.
llvm-svn: 51822
2008-05-31 19:11:15 +00:00
Dan Gohman
caa9c6e94d Fix some bugs with the handling of indices in insertvalue/extractvalue.
llvm-svn: 51820
2008-05-31 19:09:08 +00:00
Nick Lewycky
1bcd80adf7 Peer through sext/zext when looking for not(cmp).
llvm-svn: 51819
2008-05-31 19:01:33 +00:00
Nick Lewycky
566baa2c72 Yay us! Every one of these examples turns into icmp/zext/ret.
llvm-svn: 51818
2008-05-31 18:20:26 +00:00
Nick Lewycky
b30afdb62b Add more i1 optimizations. add, sub, mul, s/udiv on i1 are now simplified away.
llvm-svn: 51817
2008-05-31 17:59:52 +00:00
Nick Lewycky
cdcdcddc85 Adding i1 is always Xor.
llvm-svn: 51816
2008-05-31 17:10:28 +00:00
Chris Lattner
43a47ddd89 Fix the CBE's handling of instructions whose result is an i1. Previously,
we did not truncate the value down to i1 with (x&1).  This caused a problem
when the computation of x was nontrivial, for example, "add i1 1, 1" would 
return 2 instead of 0.

This makes the testcase compile into:

...
  llvm_cbe_t = (((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u))&1);
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

instead of:

...
  llvm_cbe_t = ((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u));
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

This fixes a miscompilation of mediabench/adpcm/rawdaudio/rawdaudio and
403.gcc with the CBE, regressions from LLVM 2.2. Tanya, please pull 
this into the release branch.

llvm-svn: 51813
2008-05-31 09:23:55 +00:00
Dan Gohman
1ab21af8e0 Factor several methods, including getInversePredicate and
getSwappedPredicate, from ICmpInst and FCmpInst into common
methods in CmpInst. This allows CmpInsts to be manipulated
generically.

llvm-svn: 51810
2008-05-31 02:47:54 +00:00
Dan Gohman
00823cb0d4 Teach the DAGISelEmitter to not compute the variable_ops operand
index for the input pattern in terms of the output pattern. Instead
keep track of how many fixed operands the input pattern actually
has, and have the input matching code pass the output-emitting
function that index value. This simplifies the code, disentangles
variables_ops from the support for predication operations, and
makes variable_ops more robust.

llvm-svn: 51808
2008-05-31 02:11:25 +00:00
Dan Gohman
0ae2954dd5 Remove an unused variable.
llvm-svn: 51807
2008-05-31 01:44:25 +00:00
Dan Gohman
ac5c3382fe IR, bitcode reader, bitcode writer, and asmparser changes to
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.

There's definately more to come here, but I'm checking this 
basic support in now to make it available to people who are
interested.

llvm-svn: 51806
2008-05-31 00:58:22 +00:00
Evan Cheng
ee4a0719c0 Fix indentation.
llvm-svn: 51793
2008-05-30 22:39:32 +00:00
Evan Cheng
f1fb1d7abf Fix indentation.
llvm-svn: 51792
2008-05-30 22:39:18 +00:00
Owen Anderson
65cfda30bd The coalescer doesn't need LiveVariables now that we have register use iterators.
llvm-svn: 51790
2008-05-30 22:37:27 +00:00
Gabor Greif
d931decf37 rewrite operand loops to use iterators
llvm-svn: 51789
2008-05-30 21:24:22 +00:00
Owen Anderson
9ba2e2794e Preserve the register coallescer, and update live intervals more correctly by triggering a renumbering after phi elimination.
llvm-svn: 51780
2008-05-30 18:38:26 +00:00
Owen Anderson
40022e00ef Since LCSSA switched over to DenseMap, we have to be more careful to avoid iterator invalidation. Fixes PR2385.
llvm-svn: 51777
2008-05-30 17:31:01 +00:00
Matthijs Kooijman
9fc9250ec0 Give a proper error message when a command line option is defined more than
once (ie, at two different places in the source, not two times on the
commandline).

llvm-svn: 51771
2008-05-30 13:26:11 +00:00
Matthijs Kooijman
861df1986d Use eraseFromParent() instead of doing that manually in two places.
llvm-svn: 51770
2008-05-30 12:35:46 +00:00
Matthijs Kooijman
32c5d3a9ee Let Instruction::getOpcodeName() return something useful for the new
insertvalue / extractvalue instructions.

llvm-svn: 51766
2008-05-30 10:31:54 +00:00
Bill Wendling
244b4db58d Add the "AsCheapAsAMove" flag to some 64-bit xor instructions.
llvm-svn: 51761
2008-05-30 06:47:04 +00:00