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

3802 Commits

Author SHA1 Message Date
Devang Patel
9aba178666 Fix PR 1995.
llvm-svn: 46898
2008-02-08 22:49:13 +00:00
Bill Wendling
8a28ab4b1f Temporarily reverting:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057882.html

This is causing a miscompilation on PPC G5 and just now seeing it on iMac x86-64.

llvm-svn: 46822
2008-02-06 20:03:07 +00:00
Chris Lattner
5c9fc804d7 Make RenamePass faster by making the 'is this a new phi node'
check more intelligent.  This speeds up mem2reg from 5.29s to 
0.79s on a synthetic testcase with tons of predecessors and
phi nodes.

llvm-svn: 46767
2008-02-05 21:26:23 +00:00
Chris Lattner
96deed5d4d Fix a bug compiling PR1978 (perhaps not the only one though) which
was incorrectly simplifying "x == (gep x, 1, i)" into false, even 
though i could be negative.  As it turns out, all the code to 
handle this already existed, we just need to disable the incorrect
optimization case and let the general case handle it.

llvm-svn: 46739
2008-02-05 04:45:32 +00:00
Owen Anderson
af0449f9e0 Be more precise when eliminating pointers bue to memcpy's. This allows more
stores to be deleted in some cases.

llvm-svn: 46694
2008-02-04 04:53:00 +00:00
Owen Anderson
aaba6f96da Allow GVN to hack on memcpy's, making them open to further optimization.
llvm-svn: 46693
2008-02-04 02:59:58 +00:00
Nick Lewycky
febd3642ce There are some cases where icmp(add) can be folded into a new icmp. Handle them.
llvm-svn: 46687
2008-02-03 16:33:09 +00:00
Nick Lewycky
29cd604126 Hack on vectors too.
llvm-svn: 46684
2008-02-03 08:19:11 +00:00
Nick Lewycky
ce4c4698d7 Fold away one multiply in instcombine. This would normally be caught in
reassociate anyways, but they could be generated during instcombine's run.

llvm-svn: 46683
2008-02-03 07:42:09 +00:00
Duncan Sands
454a8eaee9 Don't drop function/call return attributes like 'nounwind'.
llvm-svn: 46645
2008-02-01 20:37:16 +00:00
Nick Lewycky
ccd60a90c5 Remove a couple more cases of "getNumUses() == 0". No need to walk the linked
list just to see if whether the list is empty.

llvm-svn: 46555
2008-01-30 08:01:28 +00:00
Nick Lewycky
e3818dcc4e Use empty() instead of comparing size() with zero.
llvm-svn: 46554
2008-01-30 07:54:16 +00:00
Nick Lewycky
719599d263 Don't DCE FreeInst's. We were using those! Patch from Owen Anderson.
llvm-svn: 46553
2008-01-30 07:45:37 +00:00
Owen Anderson
ad9a347656 Make DSE much more aggressive by performing DCE earlier. Update a testcase to reflect this increased aggressiveness.
llvm-svn: 46542
2008-01-30 01:24:47 +00:00
Chris Lattner
83227e350d Fix a bug where scalarrepl would discard offset if type would match.
In practice this can only happen on code with already undefined behavior, 
but this is still a good thing to handle correctly.

llvm-svn: 46539
2008-01-30 00:39:15 +00:00
Chris Lattner
e08ec140e0 Don't let globalopt hack on volatile loads or stores.
llvm-svn: 46523
2008-01-29 19:01:37 +00:00
Dan Gohman
aad233ea10 Use empty() instead of comparing size() with zero.
llvm-svn: 46514
2008-01-29 13:02:09 +00:00
Chris Lattner
83f411c586 eliminate additions of 0.0 when they are obviously dead. This has to be careful to
avoid turning -0.0 + 0.0 -> -0.0 which is incorrect.

llvm-svn: 46499
2008-01-29 06:52:45 +00:00
Owen Anderson
96b9e5423a Add support for eliminating memcpy's at the end of functions. Also fix some errors I noticed in
the handling of eliminating stores to byval arguments.

llvm-svn: 46494
2008-01-29 06:18:36 +00:00
Devang Patel
86ff705c22 Filter loops that subtract induction variables.
These loops are not yet handled.

Fix PR 1912.

llvm-svn: 46484
2008-01-29 02:20:41 +00:00
Chris Lattner
dc0c4352bd Transform calls to memcpy into llvm.memcpy calls, patch by Eli Friedman.
llvm-svn: 46433
2008-01-28 04:41:43 +00:00
Nick Lewycky
6b070b1b93 Handle some more combinations of extend and icmp. Fixes PR1940.
llvm-svn: 46431
2008-01-28 03:48:02 +00:00
Chris Lattner
359756ea4b Fix PR1932 by disabling an xform invalid for fdiv.
llvm-svn: 46429
2008-01-28 00:58:18 +00:00
Chris Lattner
7250586ec9 Fix PR1938 by forcing the code that uses an undefined value to branch one
way or the other.  Rewriting the code itself prevents subsequent analysis
passes from making contradictory conclusions about the code that could 
cause an infeasible path to be made feasible.

llvm-svn: 46427
2008-01-28 00:32:30 +00:00
Nick Lewycky
cd28ef8950 Be more careful modifying the use_list while also iterating through it.
llvm-svn: 46417
2008-01-27 18:35:00 +00:00
Duncan Sands
e77256b325 Revert r46393: readonly/readnone functions are no
longer allowed to write through byval arguments.

llvm-svn: 46416
2008-01-27 18:12:58 +00:00
Bill Wendling
629a569ce9 The CorrelatedExpressionElimination pass is known to be buggy. Remove it.
This fixes PR1769.

llvm-svn: 46408
2008-01-27 06:11:41 +00:00
Chris Lattner
aa553aa0c1 Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.
llvm-svn: 46406
2008-01-27 05:29:54 +00:00
Bill Wendling
1c92468074 If there are no machine instructions emitted for a function, then insert
a "nop" instruction so that we don't have the function's label associated
with something that it's not supposed to be associated with.

llvm-svn: 46394
2008-01-26 06:51:24 +00:00
Duncan Sands
792234c366 Create an explicit copy for byval parameters even
when inlining a readonly function.

llvm-svn: 46393
2008-01-26 06:41:49 +00:00
Bill Wendling
1e56a2ffb6 If we have a function like this:
void bork() {
  int *address = 0;
  *address = 0;
}

It's compiled into LLVM code that looks like this:

define void @bork() noreturn nounwind  {
entry:
        unreachable
}

This is bad on some platforms (like PPC) because it will generate the label for
the function but no body. The label could end up being associated with some
non-code related stuff, like a section. This places a "trap" instruction if the
SimplifyCFG pass removed all code from the function leaving only one
"unreachable" instruction.

llvm-svn: 46387
2008-01-26 01:43:44 +00:00
Duncan Sands
10316ffbb2 Do this more neatly.
llvm-svn: 46369
2008-01-25 22:06:51 +00:00
Owen Anderson
a4ff15c69f DeadStoreElimination can treat byval parameters as if there were alloca's for the purpose of removing end-of-function stores.
llvm-svn: 46351
2008-01-25 10:10:33 +00:00
Nick Lewycky
13b6bc91d6 Enable the fix I just checked in, silly me.
llvm-svn: 46247
2008-01-22 05:42:02 +00:00
Nick Lewycky
78780f175b Multiply can be evaluated in a different type, so long as the target type has
a smaller bitwidth.

llvm-svn: 46244
2008-01-22 05:08:48 +00:00
Duncan Sands
8a2778c20e Make sure the caller doesn't use freed memory.
Fixes PR1935.

llvm-svn: 46203
2008-01-20 16:51:46 +00:00
Duncan Sands
85db5b21a7 Initializing an unsigned with ~0UL causes the compiler
to complain on x86-64 (gcc 4.1).  Use ~0U instead.

llvm-svn: 46197
2008-01-20 10:49:23 +00:00
Evan Cheng
c187163bab DAE bug fix. Don't lose parameter attributes on vararg arguments.
llvm-svn: 46113
2008-01-17 04:18:54 +00:00
Chris Lattner
c32be7e6b2 Fix arg promotion to propagate the correct attrs on the calls to
promoted functions.  This is important for varargs calls in 
particular.  Thanks to duncan for providing a great testcase.

llvm-svn: 46108
2008-01-17 01:17:03 +00:00
Chris Lattner
81a39bb7ba Handle attribute(used) global variables that are i8.
llvm-svn: 46090
2008-01-16 21:35:43 +00:00
Devang Patel
a8d63b0b30 Do not strip llvm.used values.
llvm-svn: 46045
2008-01-16 03:33:05 +00:00
Duncan Sands
81e35b4d47 I noticed that the trampoline straightening transformation could
drop attributes on varargs call arguments.  Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility).  Fix both problems.

llvm-svn: 45973
2008-01-14 19:52:09 +00:00
Chris Lattner
efb498eddb Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
byval work.  This miscompilation is due to the program indexing an array out
of range and us doing a transformation that broke this.

llvm-svn: 45949
2008-01-14 02:09:12 +00:00
Chris Lattner
5d135cc20a The isNotSuitableForSRA property is now dead, don't compute it.
llvm-svn: 45948
2008-01-14 01:32:52 +00:00
Chris Lattner
760b05a331 Change SRAGlobal to not depend on isNotSuitableForSRA, which makes it very
difficult to understand the invariants.

llvm-svn: 45947
2008-01-14 01:31:05 +00:00
Chris Lattner
c2933482a0 Make the 'shrink global to bool' optimization more self contained, and thus
easier to show that its safe.  No functionality change.

llvm-svn: 45946
2008-01-14 01:17:44 +00:00
Chris Lattner
d22a5f6314 Turn a memcpy from a double* into a load/store of double instead of
a load/store of i64.  The later prevents promotion/scalarrepl of the
source and dest in many cases.

This fixes the 300% performance regression of the byval stuff on 
stepanov_v1p2.

llvm-svn: 45945
2008-01-14 00:28:35 +00:00
Chris Lattner
8560bb9d98 factor memcpy/memmove simplification out to its own SimplifyMemTransfer
method, no functionality change.

llvm-svn: 45944
2008-01-13 23:50:23 +00:00
Chris Lattner
5fbf76aaf4 simplify some code. If we can infer alignment for source and dest that are
greater than memcpy alignment, and if we lower to load/store, use the best 
alignment info we have.

llvm-svn: 45943
2008-01-13 22:30:28 +00:00
Chris Lattner
4f69f1a721 simplify some code by adding a InsertBitCastBefore method,
make memmove->memcpy conversion a bit simpler.

llvm-svn: 45942
2008-01-13 22:23:22 +00:00