Commit Graph

5429 Commits

Author SHA1 Message Date
Chris Lattner
845f0d2f0f 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52301 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:19:11 +00:00
Chris Lattner
5db5bf425d this is unneeded now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 04:25:39 +00:00
Chris Lattner
5465cc59f0 resolve PR2453 by adding a run line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 04:22:39 +00:00
Wojciech Matyjewicz
8a08769bad 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 19:07:39 +00:00
Evan Cheng
87bb991aa8 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 23:58:02 +00:00
Eli Friedman
6100119620 Remove unnecessary target lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52261 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 22:12:16 +00:00
Eli Friedman
6783cdcbd2 Remove unnecessary target lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52260 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 22:10:32 +00:00
Eli Friedman
6903a24f32 Don't skip over instructions other than loads that might read memory
when trying to sink stores.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 22:02:12 +00:00
Dan Gohman
e562b1725e Protect ChangeCompareStride from situations in which it is possible
for it to generate use-before-def IR, such as in this testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 21:43:41 +00:00
Eli Friedman
66fe80aa57 Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the
structure checks are incorrect if the blocks aren't distinct.
Fixes PR2435.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 21:17:49 +00:00
Duncan Sands
d4b9c17fb7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 19:07:40 +00:00
Matthijs Kooijman
818ae72d04 XFAIL some tests that became failing due to the extra error reporting recently. PR's are created for these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52250 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 16:52:35 +00:00
Nick Lewycky
6f8abf929a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 04:38:55 +00:00
Evan Cheng
933b5065e5 Fix some tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52245 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 21:23:38 +00:00
Evan Cheng
0d0ca8572f Revert 52223.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52243 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 20:55:39 +00:00
Matthijs Kooijman
d4646cd40f Don't try to compile tests for the ev56 alpha subtarget, which hasn't been
supported since r33492.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52237 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 13:44:26 +00:00
Matthijs Kooijman
1971e1248f Pass -silence-passes to bugpoint in testcases, this makes two out of three bugpoint testcases work again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52236 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 13:12:11 +00:00
Matthijs Kooijman
ca9bcb0fda Add line continuation character so the avoid dup loop header test actually runs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52228 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 08:49:04 +00:00
Evan Cheng
bb318c073e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 19:07:54 +00:00
Gordon Henriksen
4468440a2a Don't send checkpoints to stderr for the vmcore.ml test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 14:58:01 +00:00
Matthijs Kooijman
a9012eca1a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 14:05:05 +00:00
Dale Johannesen
c9958102ec Use %link not %llvmgxx (which includes -c) to do the link.
The test still fails because an expected symbol is not
present, and I don't see why it should be.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52188 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 18:01:54 +00:00
Dale Johannesen
e115ca544c Suppress ObjC FE warnings, which cause the test to fail.
Warnings are legitimate.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52187 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 18:00:45 +00:00
Dale Johannesen
6a02432574 Add -w to inhibit gcc warnings, which causes the
harness to fail the tests.  The warning all appear
legitimate.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52186 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 18:00:09 +00:00
Dale Johannesen
287abdb357 Fix parameter spelling: sse not sse1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 17:57:58 +00:00
Matthijs Kooijman
61d858e3f0 Ignore stderr for some more tests that expect warnings there.
This fixes 2 testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 16:13:38 +00:00
Matthijs Kooijman
5efb967052 Fix some more quoting issues in RUN lines, this time regarding unintended
variable expansions involving the $ character.

This fixes 4 tests that were not running properly before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52183 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 16:10:32 +00:00
Matthijs Kooijman
888fa33cfb Fix some escaping and quoting in RUN lines, mainly involving { and <. In two
cases quoting of <{ didn't work out, so I changed the grep to check for }>
instead.

This fixes 7 testcases that were not properly running before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52182 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 16:04:47 +00:00
Matthijs Kooijman
7f88d9c62b Remove double pipes in RUN commandlines.
This fixes 5 testcases that were not being run properly before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 15:11:36 +00:00
Matthijs Kooijman
da8bdfa92b Remove trailing whitespace after line continuations in test cases to them work.
This fixes two test cases that were not being run properly before.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 15:07:07 +00:00
Matthijs Kooijman
7361f63b25 Let some more tests ignore expected output on stderr.
Also, use > %t instead of -o %t for output in one test since that also works
when %t already exists.

This fixes 6 testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 15:04:14 +00:00
Matthijs Kooijman
b7e103ba41 Fix some llvm-gcc warnings in testcases, mostly by adding includes or adding
declarations. These are the fixes that I was pretty confident about, there are
still a lot of other llvm-gcc warnings of which I'm not sure if they can be
safely ignored or fixed, without breaking the test case.

This fixes 11 testcases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52176 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 14:37:44 +00:00
Matthijs Kooijman
1cd8f11cc0 For all RUN lines starting with "not", redirect stderr to /dev/null so tests
don't fail when (expected) error output is produced. This fixes 17 tests.

While I was there, I also made all RUN lines of the form "not llvm-as..." a bit
more consistent, they now all redirect stderr and stdout to /dev/null and use
input redirect to read their input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 12:57:32 +00:00
Matthijs Kooijman
f167bc2922 Suppress the (stderr) output of -aa-eval, this fixes 5 tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52173 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 12:39:15 +00:00
Matthijs Kooijman
c9e00434e3 Change llvm.exp so it no longer ignores some errors when executing dejagnu
tests. This breaks 80 tests in the tree.

The interesting part here is that this no longer ignores syntax errors
in RUN command lines. Some tests have not been working all the time because of
this.

The tricky part is that it now also views any stderr output as an error. This
can be suppressed in tcl 8.5, but let's not add this dependency. Instead, all
testcases should be changed to redirect stderr if they expect stderr output.
This holds in particular for lines like:
  ; RUN: not llvm-as < %s
where an error is expected (but I think I can solve this by modifying the not
script). Also, compilations resulting in warnings will now also fail (so
the warnings should be fixed, disabled or redirected...).

I'll continue with fixing the testcases that are broken now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 12:28:43 +00:00
Dan Gohman
c5b822b5b6 Convert several tests to use temporary files instead of redundantly
executing the test commands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 00:36:41 +00:00
Dan Gohman
9eb698b96d Fix two more not-grep tests that were missing llvm-dis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52159 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 22:36:45 +00:00
Dan Gohman
7dc1def162 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:26:13 +00:00
Duncan Sands
eddc8f1f8b Test that prune-eh doesn't make deductions based
on bodies of functions with weak linkage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 11:28:41 +00:00
Rafael Espindola
d674b4e87d add support for PIC on linux x86-64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 09:52:31 +00:00
Chris Lattner
313f0e63f7 lower calls to abs to inline code, PR2337
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 08:26:51 +00:00
Chris Lattner
18d73c206e Fix PR2411, where ip constant prop would propagate the
result of a weak function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:58:07 +00:00
Chris Lattner
7d8ab4efbc 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 20:52:11 +00:00
Anton Korobeynikov
7aa700e979 Remove invalid test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 16:59:10 +00:00
Evan Cheng
4d09efd7b8 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52073 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 08:52:29 +00:00
Evan Cheng
cce302fded Fix run line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 08:40:16 +00:00
Anton Korobeynikov
7aa8d44429 Testcase for PR2418
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 16:08:56 +00:00
Dan Gohman
836bfcd689 Revert 52002.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 23:57:06 +00:00
Zhou Sheng
b73afcf6dc Add a test case for opt -instcombine bug fix in revision 52003.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52004 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:25:11 +00:00
Matthijs Kooijman
411e6a5efb Change the Verifier to support returning first class aggregrates.
Add a testcase for functions returning first class aggregrates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:00:36 +00:00
Zhou Sheng
b499c86331 Add a test case for APInt bug fix in r51999.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 13:42:21 +00:00
Matthijs Kooijman
02518140ac 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 12:51:53 +00:00
Matthijs Kooijman
47c6fd7317 Let StructRetPromotion check if all if its users are really calls or invokesn,
not other instructions. This fixes a crash with the added testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 08:57:20 +00:00
Matthijs Kooijman
257da0a7fc Let StructRetPromotion check if it's users are really calling it and not
passing its pointer. Fixes test with added testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 08:48:32 +00:00
Evan Cheng
fb4db316d8 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 23:37:54 +00:00
Chris Lattner
67f631dfd5 Rewrite a bunch of the CBE's inline asm code, giving it the
ability to handle indirect input operands.  This fixes PR2407.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51952 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 18:03:28 +00:00
Duncan Sands
a0fcc08e65 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51928 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-04 08:21:45 +00:00
Owen Anderson
3637981050 Testcase for LoopIndexSplit and DomFrontier.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51916 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 18:32:27 +00:00
Dan Gohman
6d9861120e nounwindify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 01:21:11 +00:00
Dan Gohman
6e68f59b78 Constant folding for insertvalue and extractvalue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-03 00:15:20 +00:00
Devang Patel
2f170997b5 Update dom tree. Fix PR 2372.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 22:52:56 +00:00
Scott Michel
8bf61e8c2a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 22:18:03 +00:00
Dan Gohman
193c235850 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 21:30:49 +00:00
Dan Gohman
37cdad3e59 Fix the position of MemOperands in nodes that use variadic_ops
in DAGISelEmitter output. This bug was recently uncovered by the
addition of patterns for CALL32m and CALL64m, which are nodes
that now have both MemOperands and variadic_ops.

This bug was especially visible with PIC in various configurations,
because the new patterns are matching the indirect call code used
in many PIC configurations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 17:40:38 +00:00
Wojciech Matyjewicz
98e3a6829a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 17:26:12 +00:00
Owen Anderson
009e4f7609 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);


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 22:26:26 +00:00
Owen Anderson
19d4d12ee0 Test for PR2401
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51849 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 21:55:55 +00:00
Duncan Sands
f413cdfb0b 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51834 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-01 07:38:42 +00:00
Chris Lattner
76931954f8 update this patch to handle an extraneous &1. This should be pulled
into the 2.3 release branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 19:50:53 +00:00
Nick Lewycky
517e1f5cd7 Peer through sext/zext when looking for not(cmp).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51819 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 19:01:33 +00:00
Nick Lewycky
9419ddb289 Add more i1 optimizations. add, sub, mul, s/udiv on i1 are now simplified away.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 17:59:52 +00:00
Nick Lewycky
fd12a0b20b Adding i1 is always Xor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51816 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 17:10:28 +00:00
Chris Lattner
e56d946a38 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51813 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 09:23:55 +00:00
Dan Gohman
81a0c0b44e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-31 00:58:22 +00:00
Mikhail Glushenkov
74a0c28fba Fix the -opt switch and add a test case for it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 19:56:27 +00:00
Mikhail Glushenkov
34f376281f Fix: 'sink' handling was broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 06:23:29 +00:00
Nick Lewycky
61435195ce Unbreak this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51726 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 05:02:37 +00:00
Dan Gohman
b4106170dd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 21:50:34 +00:00
Dan Gohman
21323f3a82 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 19:42:22 +00:00
Anton Korobeynikov
0b85642898 For PR1338: Rename test dirs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 19:17:15 +00:00
Owen Anderson
8cacfebb8e Move these tests into the proper directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51685 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 16:30:29 +00:00
Owen Anderson
038a8746c9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 08:45:13 +00:00
Evan Cheng
f26ffe987c Implement vector shift up / down and insert zero with ps{rl}lq / ps{rl}ldq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 08:22:04 +00:00
Evan Cheng
e65b9a48e3 Add nounwind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51665 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-29 07:09:24 +00:00
Evan Cheng
d77d4f98fb Fix PR2289: vr defined by multiple implicit_def as result of coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 17:40:10 +00:00
Evan Cheng
33d3d4ad40 Teach local register allocator to deal with landing pad MBB's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51647 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 17:22:32 +00:00
Chris Lattner
a935db8ea2 Implement PR2370: memmove(x,x,size) -> noop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 05:30:41 +00:00
Dan Gohman
caa98d3ab9 Specify a target so that this tests tests what it's intended to test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 17:55:57 +00:00
Dan Gohman
95628cd44a Make this test independent of the target-triple; the stack alignment
is specifically what this test depends on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 17:44:23 +00:00
Nick Lewycky
aadc6b68c7 Whoops -- forgot PR reference on this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51569 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 20:23:33 +00:00
Nick Lewycky
3978927dfa The Linux ABI emits an extra "movl %esp, %ebp" in function prologue and
sometimes a "mov %ebp, %esp" in the epilogue.

Force these tests that rely on counting 'mov' to use i686-apple-darwin8.8.0
where they were written.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51568 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 20:18:56 +00:00
Nick Lewycky
505242f9b6 Use {} instead of "" in RUN lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 01:27:08 +00:00
Nick Lewycky
04b35e8532 Don't treat values as signed when looking at loop steppings in HowForToNonZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 23:43:32 +00:00
Nick Lewycky
3dfd7bf511 "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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 20:56:15 +00:00
Chris Lattner
393f7eb60a Fix a serious brain-o. Obviously no-one reviewed my patch :(
This fixes PR2359


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51536 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 04:06:28 +00:00
Chris Lattner
60301608f8 Fix PR2358 by resolving calls with undef arguments to overdefined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 03:59:33 +00:00
Evan Cheng
a31593901d Eliminate x86.sse2.punpckh.qdq and x86.sse2.punpckl.qdq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 02:56:30 +00:00
Evan Cheng
e716bb1c59 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51531 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 02:14:05 +00:00
Evan Cheng
ef1ba3844d New loadl_pd and loadh_pd tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:10:02 +00:00
Evan Cheng
4797f61657 Autoupgrade x86.sse2.loadh.pd and x86.sse2.loadl.pd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:08:39 +00:00