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
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
Dan Gohman
72f5ed6a0d Remove an unused variable.
llvm-svn: 51721
2008-05-30 00:56:36 +00:00
Dan Gohman
15eb8b47aa Fix a typo in a comment.
llvm-svn: 51718
2008-05-30 00:08:18 +00:00
Dan Gohman
24ad4a21e3 Fix a copy+paste error in a comment.
llvm-svn: 51717
2008-05-30 00:02:02 +00:00
Owen Anderson
5ff0c098ae Make the renumbering correct in the face of deleted instructions that have been removed from the LiveIntervals maps.
llvm-svn: 51714
2008-05-29 23:01:22 +00:00
Bill Wendling
bcd38344b9 Unbreak build.
llvm-svn: 51709
2008-05-29 22:02:08 +00:00
Dan Gohman
aa8fcd5657 Add patterns for CALL32m and CALL64m. They aren't matched in most
cases due to an isel deficiency already noted in
lib/Target/X86/README.txt, but they can be matched in this fold-call.ll
testcase, for example.

This is interesting mainly because it exposes a tricky tblgen bug;
tblgen was incorrectly computing the starting index for variable_ops
in the case of a complex pattern.

llvm-svn: 51706
2008-05-29 21:50:34 +00:00
Bill Wendling
2ba98ca60f Remove more iostream header includes. Needed to implement a "FlushStream"
function to flush a specified std::ostream.

llvm-svn: 51705
2008-05-29 21:46:33 +00:00
Bill Wendling
4a95fce74c Remove <iostream>.
llvm-svn: 51704
2008-05-29 21:29:39 +00:00
Owen Anderson
0eabbbfc58 Add newline at end of file.
llvm-svn: 51701
2008-05-29 21:05:16 +00:00
Dan Gohman
4e87d82476 Fix a tblgen problem handling variable_ops in tblgen instruction
definitions. This adds a new construct, "discard", for indicating
that a named node in the input matching pattern is to be discarded,
instead of corresponding to a node in the output pattern. This
allows tblgen to know where the arguments for the varaible_ops are
supposed to begin.

This fixes "rdar://5791600", whatever that is ;-).

llvm-svn: 51699
2008-05-29 19:57:41 +00:00
Dan Gohman
d8b84813d5 const-ify getOpcode.
llvm-svn: 51698
2008-05-29 19:53:46 +00:00
Dan Gohman
e256337a1a Expand small memmovs using inline code. Set the X86 threshold for expanding
memmove to a more plausible value, now that it's actually being used.

llvm-svn: 51696
2008-05-29 19:42:22 +00:00
Owen Anderson
7de6e25492 Revert part of my last patch that I didn't intend to commit yet.
llvm-svn: 51694
2008-05-29 18:35:21 +00:00
Owen Anderson
9db9e1a6a4 Renumbering needs to account for instruction slot offsets when performing lookups in the index maps.
llvm-svn: 51691
2008-05-29 18:15:49 +00:00
Owen Anderson
0e26c5897a Force postdom to be linked into opt and bugpoint, even though it is no longer used by any passes.
llvm-svn: 51686
2008-05-29 17:00:13 +00:00
Duncan Sands
18fb7b1fa3 Add a newline at the end of this file.
llvm-svn: 51680
2008-05-29 14:38:23 +00:00
Owen Anderson
bd3940abc7 Replace the old ADCE implementation with a new one that more simply solves
the one case that ADCE catches that normal DCE doesn't: non-induction variable
loop computations.

This implementation handles this problem without using postdominators.

llvm-svn: 51668
2008-05-29 08:45:13 +00:00
Evan Cheng
04c0915a2f Implement vector shift up / down and insert zero with ps{rl}lq / ps{rl}ldq.
llvm-svn: 51667
2008-05-29 08:22:04 +00:00
Owen Anderson
ccaf62ac5e Remove debugging code.
llvm-svn: 51666
2008-05-29 08:15:48 +00:00
Bill Wendling
81199f0cc8 XOR?RI instructions aren't as cheap as moves.
llvm-svn: 51664
2008-05-29 03:46:36 +00:00
Gabor Greif
b320ae0f07 convert more operand loops to iterator formulation
llvm-svn: 51663
2008-05-29 01:59:18 +00:00
Bill Wendling
edb38e9410 Implement "AsCheapAsAMove" for some obviously cheap instructions: xor and the
like.

llvm-svn: 51662
2008-05-29 01:02:09 +00:00
Gabor Greif
39350bab39 convert another operand loop to iterator formulation
llvm-svn: 51661
2008-05-29 00:51:08 +00:00
Bill Wendling
b56bc61cf4 Add a flag to indicate that an instruction is as cheap (or cheaper) than a move
instruction to execute. This can be used for transformations (like two-address
conversion) to remat an instruction instead of generating a "move"
instruction. The idea is to decrease the live ranges and register pressure and
all that jazz.

llvm-svn: 51660
2008-05-28 22:54:52 +00:00
Bill Wendling
5011b8d77d Check the "isSafeToMove" predicate, which has a series of tests to make sure
that it's safe to remat an instruction.

llvm-svn: 51659
2008-05-28 22:52:47 +00:00
Owen Anderson
219ecc1ff1 Remap VNInfo data as well when doing renumbering.
llvm-svn: 51658
2008-05-28 22:40:08 +00:00
Owen Anderson
705b97141c Factor the numbering computation into a separate method, and add the slightest attempt at some renumbering logic, which is currently unused.
llvm-svn: 51652
2008-05-28 20:54:50 +00:00
Evan Cheng
cd45b11bc1 Fix PR2289: vr defined by multiple implicit_def as result of coalescing.
llvm-svn: 51648
2008-05-28 17:40:10 +00:00
Evan Cheng
591b57edd6 Teach local register allocator to deal with landing pad MBB's.
llvm-svn: 51647
2008-05-28 17:22:32 +00:00
Nate Begeman
e0d283668e Update some comments noticed in a recent checkin
llvm-svn: 51644
2008-05-28 16:31:36 +00:00
Chris Lattner
7a7da4f9c3 Implement PR2370: memmove(x,x,size) -> noop.
llvm-svn: 51636
2008-05-28 05:30:41 +00:00
Chris Lattner
857e1e9cab Add chain inputs for loads.
llvm-svn: 51635
2008-05-28 04:25:57 +00:00
Chris Lattner
93047192f3 Fix CodeGen/Generic/2005-10-21-longlonggtu.ll on ia64.
llvm-svn: 51634
2008-05-28 04:14:30 +00:00
Chris Lattner
294b436abf loads should get chains. THis helps but does not solve CodeGen/Generic/2003-05-27-phifcmpd.ll
on ia64.

llvm-svn: 51633
2008-05-28 04:06:52 +00:00
Chris Lattner
d33dececf3 Fix 2006-04-28-Sign-extend-bool.ll for ia64.
llvm-svn: 51632
2008-05-28 04:00:06 +00:00
Chris Lattner
569e867c01 reindent.
llvm-svn: 51631
2008-05-28 03:59:32 +00:00
Dan Gohman
a5549a2f9c Fix the encoding for two more "rm" instructions that were using MRMSrcReg.
llvm-svn: 51630
2008-05-28 01:50:19 +00:00
Mon P Wang
8e37b2d13e Fixed X86 encoding error CVTPS2PD and CVTPD2PS when the source operand
is a memory location

llvm-svn: 51626
2008-05-28 00:42:27 +00:00
Nate Begeman
23dd264da6 Don't attempt to create VZEXT_LOAD out of an extload. This an issue where the
code generator would do something like this:

f64 = load f32 <anyext>, f32mem
v2f64 = insertelt undef, %0, 0
v2f64 = insertelt %1, 0.0, 1

into 

v2f64 = vzext_load f32mem

which on x86 is movsd, when you really wanted a cvtss2sd/movsd pair.

llvm-svn: 51624
2008-05-28 00:24:25 +00:00
Dan Gohman
4b11213552 Use Function::getEntryBlock instead of Function::begin, for clarity.
llvm-svn: 51613
2008-05-27 20:55:29 +00:00
Dan Gohman
327d2c6167 Print debug output when any edge becomes executable, including
the first visited edge.

llvm-svn: 51612
2008-05-27 20:47:30 +00:00
Bill Wendling
e5d738e779 Incorporated feedback: Check that the implicitly defined operands aren't used
before deleting the instruction.

llvm-svn: 51609
2008-05-27 20:40:52 +00:00
Dan Gohman
92d5dff525 Tidy up whitespace in ConstantRange::print output.
llvm-svn: 51606
2008-05-27 20:29:07 +00:00
Gabor Greif
2abf6ec2e5 back out last commit: The .cpp file for a module should include its corresponding header first, even if redundant.
llvm-svn: 51598
2008-05-27 17:26:02 +00:00
Duncan Sands
4757a8dd76 Fix some constructs that gcc-4.4 warns about.
llvm-svn: 51591
2008-05-27 11:50:51 +00:00
Gabor Greif
0b9cf0d491 prune unneeded #includes
llvm-svn: 51590
2008-05-27 11:06:03 +00:00
Gabor Greif
0fb81af839 remove unneeded reinterpret_casts
llvm-svn: 51589
2008-05-27 11:03:29 +00:00
Gabor Greif
b93cb3dc6f We have the correct headers included to know that BB isa Value. No reinterpret_cast necessary.
llvm-svn: 51588
2008-05-27 10:48:39 +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
Gabor Greif
e052a42a62 eliminate calls to deprecated Use::init() interface
llvm-svn: 51570
2008-05-26 21:33:52 +00:00
Duncan Sands
fa995d7cc5 Factor code to copy global value attributes like
the section or the visibility from one global
value to another: copyAttributesFrom.  This is
particularly useful for duplicating functions:
previously this was done by explicitly copying
each attribute in turn at each place where a
new function was created out of an old one, with
the result that obscure attributes were regularly
forgotten (like the collector or the section).
Hopefully now everything is uniform and nothing
is forgotten.

llvm-svn: 51567
2008-05-26 19:58:59 +00:00
Owen Anderson
15d473d75a Use a DenseMap instead of an std::map, speeding up the testcase in PR2368 by about a third.
llvm-svn: 51565
2008-05-26 10:07:43 +00:00
Bill Wendling
87ca2e8a41 The enabling of remat in 2-address conversion breaks this test:
Running /Users/void/llvm/llvm.src/test/CodeGen/X86/dg.exp ...
FAIL: /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll
Failed with exit(1) at line 1
while running: llvm-as < /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll | llc -march=x86 -mattr=+sse2 -stats |&  grep {1 .*folded into instructions}
child process exited abnormally

Make this conditional for now.

llvm-svn: 51563
2008-05-26 05:49:49 +00:00
Bill Wendling
62fae6aeee A problem that's exposed when machine LICM is enabled. Consider this code:
LBB1_3:   # bb
...
        xorl    %ebp, %ebp
        subl    (%ebx), %ebp
...
        incl    %ecx
        cmpl    %edi, %ecx
        jl      LBB1_3  # bb

Whe using machine LICM, LLVM converts it into:

        xorl %esi, %esi
LBB1_3: # bb
...
        movl    %esi, %ebp
        subl    (%ebx), %ebp
...
        incl    %ecx
        cmpl    %edi, %ecx
        jl      LBB1_3  # bb

Two address conversion inserts the copy instruction. However, it's cheaper to
rematerialize it, and remat helps reduce register pressure.

llvm-svn: 51562
2008-05-26 05:18:34 +00:00
Nick Lewycky
f24743a6bb Don't treat values as signed when looking at loop steppings in HowForToNonZero.
llvm-svn: 51560
2008-05-25 23:43:32 +00:00
Nick Lewycky
744dad8004 "ret (constexpr)" can't be folded into a Constant. Add a method to
Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it
to try to use targetdata to fold constant expressions on void instructions.

Also extend the icmp(inttoptr, inttoptr) folding to handle the case where
int size != ptr size.

llvm-svn: 51559
2008-05-25 20:56:15 +00:00
Owen Anderson
72cb477348 Create archives with the same permissions are ar.
Patch by Mikael Lepistö.

llvm-svn: 51540
2008-05-24 05:42:29 +00:00
Chris Lattner
a9c89da681 Add FreeBSD/PPC support, patch by Marcel Moolenaar!
llvm-svn: 51538
2008-05-24 04:58:48 +00:00
Chris Lattner
3def8b4e53 Fix a serious brain-o. Obviously no-one reviewed my patch :(
This fixes PR2359

llvm-svn: 51536
2008-05-24 04:06:28 +00:00
Chris Lattner
bde5fd685d Fix PR2358 by resolving calls with undef arguments to overdefined.
llvm-svn: 51535
2008-05-24 03:59:33 +00:00
Evan Cheng
e5e0b4660d Eliminate x86.sse2.punpckh.qdq and x86.sse2.punpckl.qdq.
llvm-svn: 51533
2008-05-24 02:56:30 +00:00
Evan Cheng
564238c841 Eliminate x86.sse2.movs.d, x86.sse2.shuf.pd, x86.sse2.unpckh.pd, and x86.sse2.unpckl.pd intrinsics. These will be lowered into shuffles.
llvm-svn: 51531
2008-05-24 02:14:05 +00:00
Duncan Sands
69bebf19a7 Tweak how ConstantFP80Ty constants are output
so that gcc doesn't warn about them.

llvm-svn: 51529
2008-05-24 01:00:52 +00:00
Dale Johannesen
2704d9e1bc Put initialized const weak objects into correct
sections on ppc32 darwin.  g++.dg/abi/key2.C

llvm-svn: 51527
2008-05-24 00:10:20 +00:00
Evan Cheng
d312ced1cf This is done.
llvm-svn: 51526
2008-05-24 00:10:13 +00:00
Evan Cheng
365e0f3932 Autoupgrade x86.sse2.loadh.pd and x86.sse2.loadl.pd.
llvm-svn: 51523
2008-05-24 00:08:39 +00:00
Evan Cheng
98a292a302 Remove x86.sse2.loadh.pd and x86.sse2.loadl.pd. These will be lowered into load and shuffle instructions.
llvm-svn: 51522
2008-05-24 00:07:29 +00:00
Evan Cheng
47bd4b07a8 Remove x86.sse2.loadh.pd and x86.sse2.loadl.pd. These will be lowered into load and shuffle instructions.
llvm-svn: 51521
2008-05-24 00:07:06 +00:00
Evan Cheng
50abc2a7f1 Revert 51440 as it breaks a bunch of PIC tests.
llvm-svn: 51513
2008-05-23 23:00:04 +00:00
Dan Gohman
abbe3d47ab Don't silently truncate array extents to 32 bits.
llvm-svn: 51505
2008-05-23 21:40:55 +00:00
Dale Johannesen
0c2dcb3cb0 Add a missed CommonLinkage check.
llvm-svn: 51503
2008-05-23 21:33:27 +00:00
Evan Cheng
4f660778f0 Use movlps / movhps to modify low / high half of 16-byet memory location.
llvm-svn: 51501
2008-05-23 21:23:16 +00:00
Dan Gohman
8b6f4366ae Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
use it instead of duplicating its functionality.

llvm-svn: 51499
2008-05-23 21:05:58 +00:00
Dan Gohman
c877140168 Add #includes to make some dependencies explicit.
llvm-svn: 51496
2008-05-23 20:40:06 +00:00
Dan Gohman
d3610b38ac Issue errors in several situations instead of aborting.
llvm-svn: 51493
2008-05-23 18:23:11 +00:00
Dan Gohman
e8422fc112 Elaborate on the entry on integer vector multiplication by constants.
llvm-svn: 51491
2008-05-23 18:05:39 +00:00
Evan Cheng
ec8bd19399 Fix a duplicated pattern.
llvm-svn: 51490
2008-05-23 18:00:18 +00:00
Dan Gohman
6cc0b4f262 Use PMULDQ for v2i64 multiplies when SSE4.1 is available. And add
load-folding table entries for PMULDQ and PMULLD.

llvm-svn: 51489
2008-05-23 17:49:40 +00:00
Evan Cheng
e7ec4690e1 New entry.
llvm-svn: 51487
2008-05-23 17:28:11 +00:00
Dale Johannesen
3d9a178ff9 Rewrite a loop to avoid using iterators pointing to
elements that have been erased.  Based on a patch
by Nicolas Capens.

llvm-svn: 51485
2008-05-23 17:19:02 +00:00
Dan Gohman
1bff0b83b0 Fix another isFirstClassType that now needs to be isSingleValueType.
This fixes recent CBE regressions.

llvm-svn: 51483
2008-05-23 16:57:00 +00:00
Matthijs Kooijman
e9217fe486 Replace some weird usage of UserOp1 introduced in r49492 by a plain if.
llvm-svn: 51482
2008-05-23 16:17:48 +00:00
Matthijs Kooijman
cf417144f6 Restucture a part of the SimplifyCFG pass and include a testcase.
The SimplifyCFG pass looks at basic blocks that contain only phi nodes,
followed by an unconditional branch. In a lot of cases, such a block (BB) can
be merged into their successor (Succ).

This merging is performed by TryToSimplifyUncondBranchFromEmptyBlock. It does
this by taking all phi nodes in the succesor block Succ and expanding them to
include the predecessors of BB. Furthermore, any phi nodes in BB are moved to
Succ and expanded to include the predecessors of Succ as well.

Before attempting this merge, CanPropagatePredecessorsForPHIs checks to see if
all phi nodes can be properly merged. All functional changes are made to
this function, only comments were updated in
TryToSimplifyUncondBranchFromEmptyBlock.

In the original code, CanPropagatePredecessorsForPHIs looks quite convoluted
and more like stack of checks added to handle different kinds of situations
than a comprehensive check. In particular the first check in the function did
some value checking for the case that BB and Succ have a common predecessor,
while the last check in the function simply rejected all cases where BB and
Succ have a common predecessor. The first check was still useful in the case
that BB did not contain any phi nodes at all, though, so it was not completely
useless.

Now, CanPropagatePredecessorsForPHIs is restructured to to look a lot more
similar to the code that actually performs the merge. Both functions now look
at the same phi nodes in about the same order.  Any conflicts (phi nodes with
different values for the same source) that could arise from merging or moving
phi nodes are detected. If no conflicts are found, the merge can happen.

Apart from only restructuring the checks, two main changes in functionality
happened.

Firstly, the old code rejected blocks with common predecessors in most cases.
The new code performs some extra checks so common predecessors can be handled
in a lot of cases. Wherever common predecessors still pose problems, the
blocks are left untouched.

Secondly, the old code rejected the merge when values (phi nodes) from BB were
used in any other place than Succ. However, it does not seem that there is any
situation that would require this check. Even more, this can be proven.

Consider that BB is a block containing of a single phi node "%a" and a branch
to Succ. Now, since the definition of %a will dominate all of its uses, BB
will dominate all blocks that use %a. Furthermore, since the branch from BB to
Succ is unconditional, Succ will also dominate all uses of %a.

Now, assume that one predecessor of Succ is not dominated by BB (and thus not
dominated by Succ). Since at least one use of %a (but in reality all of them)
is reachable from Succ, you could end up at a use of %a without passing
through it's definition in BB (by coming from X through Succ). This is a
contradiction, meaning that our original assumption is wrong. Thus, all
predecessors of Succ must also be dominated by BB (and thus also by Succ).

This means that moving the phi node %a from BB to Succ does not pose any
problems when the two blocks are merged, and any use checks are not needed.

llvm-svn: 51478
2008-05-23 09:09:41 +00:00
Matthijs Kooijman
c4ddb73290 Indent fix.
llvm-svn: 51477
2008-05-23 07:57:02 +00:00
Nick Lewycky
6a16ace643 Constant integer vectors may also be negated.
llvm-svn: 51476
2008-05-23 04:54:45 +00:00
Nick Lewycky
16773d5239 Typo.
llvm-svn: 51475
2008-05-23 04:39:38 +00:00
Nick Lewycky
bd2da8098d Revert X + X --> X * 2 optz'n which pessimizes heavily on x86.
llvm-svn: 51474
2008-05-23 04:34:58 +00:00
Chris Lattner
4c1ffef5af we compile multiply-by-constant into horrible code. Doesn't sse4 have some
instruction for doing this?

llvm-svn: 51473
2008-05-23 04:29:53 +00:00
Nick Lewycky
427209006f Implement X + X for vectors.
llvm-svn: 51472
2008-05-23 04:14:51 +00:00
Nick Lewycky
e62259c369 Fix a recently added optimization to not crash on vectors.
llvm-svn: 51471
2008-05-23 03:26:47 +00:00
Dan Gohman
67e1a58e22 Generalize the new code in instcombine's ComputeNumSignBits for handling
and/or to handle more cases (such as this add-sitofp.ll testcase), and
port it to selectiondag's ComputeNumSignBits.

llvm-svn: 51469
2008-05-23 02:28:01 +00:00
Dan Gohman
c7007dd0dc Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.

llvm-svn: 51468
2008-05-23 01:55:30 +00:00
Dan Gohman
eafccb7d8f Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51467
2008-05-23 01:52:21 +00:00
Bill Wendling
5fbba337e1 Remove warnings about comparison between signed and unsigned expressions.
llvm-svn: 51465
2008-05-23 01:29:08 +00:00
Dale Johannesen
da54faec0c Allow for switch with no cases. Was causing fault
in gcc.dg/pr27531-1.c.

llvm-svn: 51464
2008-05-23 01:01:31 +00:00
Evan Cheng
097e95b1f7 Bug: rcpps can only folds a load if the address is 16-byte aligned. Fixed many 'ps' load folding patterns in X86InstrSSE.td which are missing the proper alignment checks.
Also fixed some 80 col. violations.

llvm-svn: 51462
2008-05-23 00:37:07 +00:00
Dan Gohman
9674662036 Add more IR support for the new extractvalue and insertvalue
instructions.

llvm-svn: 51461
2008-05-23 00:36:11 +00:00
Dan Gohman
144390078f Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51460
2008-05-23 00:34:04 +00:00
Dan Gohman
698b435f13 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.

llvm-svn: 51459
2008-05-23 00:17:26 +00:00