Owen Anderson
00dba4f734
Re-apply the patch to improve the optimizations of memcpy's, with several
...
bugs fixed. This now passes PPC bootstrap.
llvm-svn: 47026
2008-02-12 21:15:18 +00:00
Eli Friedman
716c10c01e
Fix for bug 1996: optimize out loads of undef. This code basically just
...
checks for a malloc/alloca immediately followed by a load.
llvm-svn: 47006
2008-02-12 12:08:14 +00:00
Chris Lattner
dcddd64424
Fix scalarrepl to not 'miscompile' undefined code, part #2 .
...
This fixes the store case, my previous patch just fixed the load
case. rdar://5707076.
llvm-svn: 46932
2008-02-10 19:05:37 +00:00
Devang Patel
26f75e2576
Fix PR 1995.
...
llvm-svn: 46898
2008-02-08 22:49:13 +00:00
Bill Wendling
c676a0329c
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
a838141957
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
682a7dc653
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
a82c9931f4
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
c4a7c41869
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
3b59214320
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
c7a4ba044b
Hack on vectors too.
...
llvm-svn: 46684
2008-02-03 08:19:11 +00:00
Nick Lewycky
e6e3a7f6ea
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
9aa789fda3
Don't drop function/call return attributes like 'nounwind'.
...
llvm-svn: 46645
2008-02-01 20:37:16 +00:00
Nick Lewycky
6b016703a9
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
625e89c8b0
Use empty() instead of comparing size() with zero.
...
llvm-svn: 46554
2008-01-30 07:54:16 +00:00
Nick Lewycky
0e3a5cb14a
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
4e4b116750
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
b9e5b8fb9e
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
ade0abb498
Don't let globalopt hack on volatile loads or stores.
...
llvm-svn: 46523
2008-01-29 19:01:37 +00:00
Dan Gohman
70de4cb1cd
Use empty() instead of comparing size() with zero.
...
llvm-svn: 46514
2008-01-29 13:02:09 +00:00
Chris Lattner
17819d971e
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
48d37806e2
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
67fa0521b6
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
a8b4a56061
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
8ea81e8ba4
Handle some more combinations of extend and icmp. Fixes PR1940.
...
llvm-svn: 46431
2008-01-28 03:48:02 +00:00
Chris Lattner
710b441174
Fix PR1932 by disabling an xform invalid for fdiv.
...
llvm-svn: 46429
2008-01-28 00:58:18 +00:00
Chris Lattner
1b706dd680
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
efb16f7057
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
053c9871cd
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
60361a16f8
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
fa1e7eef30
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
5079483957
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
c4dc3dc3a2
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
0862e3421d
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
f52faf9a64
Do this more neatly.
...
llvm-svn: 46369
2008-01-25 22:06:51 +00:00
Owen Anderson
6af19fd1e2
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
f069264164
Enable the fix I just checked in, silly me.
...
llvm-svn: 46247
2008-01-22 05:42:02 +00:00
Nick Lewycky
78712e5b59
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
afa84da4e0
Make sure the caller doesn't use freed memory.
...
Fixes PR1935.
llvm-svn: 46203
2008-01-20 16:51:46 +00:00
Duncan Sands
fe3bef091f
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
04af661b1f
DAE bug fix. Don't lose parameter attributes on vararg arguments.
...
llvm-svn: 46113
2008-01-17 04:18:54 +00:00
Chris Lattner
5630c4f217
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
39f156183d
Handle attribute(used) global variables that are i8.
...
llvm-svn: 46090
2008-01-16 21:35:43 +00:00
Devang Patel
b3696e4f14
Do not strip llvm.used values.
...
llvm-svn: 46045
2008-01-16 03:33:05 +00:00
Duncan Sands
b5ca2e9fcb
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
26fe7ebc03
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
9a6db18b04
The isNotSuitableForSRA property is now dead, don't compute it.
...
llvm-svn: 45948
2008-01-14 01:32:52 +00:00
Chris Lattner
ab0537258f
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
20bbac3435
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
92bd785323
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