Devang Patel
54b2c77a4e
Handle multiple ret values.
...
llvm-svn: 48254
2008-03-11 22:24:29 +00:00
Dan Gohman
34ea45f10d
Check to see if a two-entry PHI block can be simplified
...
before trying to merge the block into its predecessors.
This allows two-entry-phi-return.ll to be simplified
into a single basic block.
llvm-svn: 48252
2008-03-11 21:53:06 +00:00
Dan Gohman
05907c9f06
Make this test more challenging to help it avoid being
...
optimized away before it tests what it is intended to test.
llvm-svn: 48251
2008-03-11 21:47:57 +00:00
Devang Patel
6c189c16b5
Initial multiple return values support.
...
llvm-svn: 48210
2008-03-11 05:46:42 +00:00
Dan Gohman
2674ad5bed
Upgrade this test.
...
llvm-svn: 48207
2008-03-11 02:19:59 +00:00
Devang Patel
659c71126e
Simplify
...
llvm-svn: 48163
2008-03-10 18:38:30 +00:00
Tanya Lattner
8ac346c316
Remove llvm-upgrade and update tests.
...
llvm-svn: 48137
2008-03-10 07:21:50 +00:00
Nick Lewycky
5dd879d5b5
Turn unwind_to into "unwinds to".
...
llvm-svn: 48123
2008-03-10 02:20:00 +00:00
Tanya Lattner
9aa573954c
Remove llvm-upgrade and update tests.
...
llvm-svn: 48103
2008-03-09 08:16:40 +00:00
Nick Lewycky
4732d3c9b7
Firstly, having a BranchInst isn't exclusive with having an unwind_to.
...
Secondly, we have to check whether the branch is actually pointing to the block
with the unwind in it. We could have gotten here because of the unwind_to alone.
llvm-svn: 48099
2008-03-09 07:50:37 +00:00
Nick Lewycky
e93a1819dc
A BB that unwind_to an "unwind" inst is that same as one that doesn't unwind_to
...
at all.
llvm-svn: 48096
2008-03-09 07:36:38 +00:00
Nick Lewycky
d98272094e
Update the inliner and simplifycfg to handle unwind_to.
...
llvm-svn: 48086
2008-03-09 05:10:13 +00:00
Nick Lewycky
980738baf2
Prune the unwind_to labels on BBs that don't need them. Another step in the
...
removal of invoke, PR1269.
llvm-svn: 48084
2008-03-09 04:55:16 +00:00
Devang Patel
9543238662
Update inliner to handle functions that return multiple values.
...
llvm-svn: 48020
2008-03-07 20:06:16 +00:00
Devang Patel
a6ec13ef6b
Place for sret promotion tests.
...
llvm-svn: 48016
2008-03-07 20:00:15 +00:00
Nick Lewycky
c6edcb8904
Commit the testcase too.
...
llvm-svn: 47988
2008-03-06 06:50:03 +00:00
Nick Lewycky
f249c5d5ad
Don't try to simplify urem and srem using arithmetic rules that don't work
...
under modulo (overflow). Fixes PR1933.
llvm-svn: 47987
2008-03-06 06:48:30 +00:00
Devang Patel
84e9abbb60
Use cast instead of dyn_cast.
...
Update test to use multiple return value directly, instead of relying on -sretpromotion.
llvm-svn: 47907
2008-03-04 21:45:28 +00:00
Devang Patel
a14b91d6a3
Handle multiple return values.
...
llvm-svn: 47904
2008-03-04 21:15:15 +00:00
Tanya Lattner
c072619922
Remove llvm-upgrade and update test cases.
...
llvm-svn: 47793
2008-03-01 09:15:35 +00:00
Chris Lattner
75f5d14574
fix a bug Anders ran into where scalarrepl would crash when promoting
...
a union containing a vector and an array whose elements were smaller than
the vector elements. this means we need to compile the load of the
array elements into an extract element plus a truncate.
llvm-svn: 47752
2008-02-29 07:12:06 +00:00
Chris Lattner
5aeccb7353
Folding or(fcmp,fcmp) only works if the operands of the fcmps are the same fp type.
...
llvm-svn: 47750
2008-02-29 06:09:11 +00:00
Owen Anderson
a39b18223f
Add PR number to testcase.
...
llvm-svn: 47640
2008-02-26 23:16:11 +00:00
Owen Anderson
eadd074b22
Fix an issue where GVN had the sizes of the two memcpy's reverse, resulting
...
in an invalid transformation.
llvm-svn: 47639
2008-02-26 23:06:17 +00:00
Chris Lattner
9d19e558b7
fix this test so that the fn name doesn't match the regex
...
llvm-svn: 47608
2008-02-26 18:13:51 +00:00
Gabor Greif
a8990a9cac
Really feed llvm-as with the testcase, do not let it read from stdin. This fixes the hangs seen on solaris10.
...
llvm-svn: 47604
2008-02-26 13:37:13 +00:00
Owen Anderson
6eafd532ab
Fix an issue where GVN was performing the return slot optimization when it was
...
not safe. This is fixed by more aggressively checking that the return slot is
not used elsewhere in the function.
llvm-svn: 47544
2008-02-25 04:08:09 +00:00
Owen Anderson
432abc0479
Fix an issue where GVN would try to use an instruction before its definition when performing return slot optimization.
...
llvm-svn: 47541
2008-02-25 00:40:41 +00:00
Zhou Sheng
5f4e29db89
Testcase for Revision 47478.
...
llvm-svn: 47531
2008-02-23 10:59:51 +00:00
Nick Lewycky
1f3c58df08
Correctly fold divide-by-constant, even when faced with overflow.
...
llvm-svn: 47287
2008-02-18 22:48:05 +00:00
Chris Lattner
a6dc8aaa3f
make this just a bit more strict.
...
llvm-svn: 47274
2008-02-18 17:33:10 +00:00
Owen Anderson
7b092ea631
Add support to GVN for performing sret return slot optimization. This means that, if an sret function tail calls
...
another sret function, it should pass its own sret parameter to the tail callee, allowing it to fill in the correct
return value. llvm-gcc does not emit this by default. Instead, it allocates space in the caller for the sret of
the tail call and then uses memcpy to copy the result into the caller's sret parameter. This optimization detects
and optimizes that case.
llvm-svn: 47265
2008-02-18 09:24:53 +00:00
Chris Lattner
9851db050b
optimize away stackrestore calls that have no intervening alloca or call.
...
llvm-svn: 47258
2008-02-18 06:12:38 +00:00
Chris Lattner
dd489bf3eb
upgrade this test.
...
llvm-svn: 47257
2008-02-18 06:11:00 +00:00
Chris Lattner
2fa904b3af
Fold (-x + -y) -> -(x+y) which promotes better association, fixing
...
the second half of PR2047
llvm-svn: 47244
2008-02-17 21:03:36 +00:00
Chris Lattner
4a34461d64
Split up subtracts into add+negate if they have a reassociable use or operand
...
that is also a subtract. This implements PR2047 and Transforms/Reassociate/subtest2.ll
llvm-svn: 47241
2008-02-17 20:51:26 +00:00
Chris Lattner
7cd16f34b3
upgrade and simplify this test.
...
llvm-svn: 47240
2008-02-17 20:48:43 +00:00
Duncan Sands
cd0325cce1
Remove any 'nest' parameter attributes if the function
...
is not passed as an argument to a trampoline intrinsic.
llvm-svn: 47220
2008-02-16 20:56:04 +00:00
Devang Patel
8af92b942c
If loop header is also loop exiting block then OrigPN is incoming value for B loop header.
...
Fixes PR 2030.
llvm-svn: 47141
2008-02-14 23:18:47 +00:00
Chris Lattner
b8bf200b77
Fix PR2029
...
llvm-svn: 47129
2008-02-14 19:18:13 +00:00
Nick Lewycky
12098ea401
Testcase for PR2032.
...
llvm-svn: 47113
2008-02-14 07:15:11 +00:00
Devang Patel
38de2d11a5
A loop latch phi node may have uses inside loop, not just in loop header.
...
llvm-svn: 47093
2008-02-13 22:23:07 +00:00
Devang Patel
1e71afe2df
While moving exit condition, do not drop loop latch on the floor.
...
llvm-svn: 47089
2008-02-13 22:06:36 +00:00
Devang Patel
d48bbbf07b
Keep track of exit value operand number when operands are swapped.
...
llvm-svn: 47082
2008-02-13 19:48:48 +00:00
Eli Friedman
cf6273d015
Add a note pointing to PR1996.
...
llvm-svn: 47055
2008-02-13 07:56:04 +00:00
Eli Friedman
75220639b6
Add test for PR1996. (This is my first time adding a test for a
...
transform, so please review.)
llvm-svn: 47050
2008-02-13 06:55:57 +00:00
Owen Anderson
274aa2846e
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
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
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
e2150dfe24
Make this test more aggressive, to cover recent improvements.
...
llvm-svn: 46695
2008-02-04 04:55:24 +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
81cc718a25
Tag this test with the PR reference.
...
llvm-svn: 46688
2008-02-03 16:35:19 +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
Duncan Sands
454a8eaee9
Don't drop function/call return attributes like 'nounwind'.
...
llvm-svn: 46645
2008-02-01 20:37:16 +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
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
2688087c9c
Add a testcase for eliminating memcpy's at the end of functions. Forgot to commit this with my last commit.
...
llvm-svn: 46497
2008-01-29 06:40:32 +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
20854cf4e7
this test is now compiled into the right thing.
...
llvm-svn: 46454
2008-01-28 17:38:46 +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
0e2b8c2c45
The CorrelatedExpressions pass is now no more.
...
llvm-svn: 46409
2008-01-27 06:13:32 +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
Duncan Sands
9fae964ef7
Invert this test, because it is wrong if we allow
...
readonly functions to use byval parameters as local
storage (how much do we want this?).
llvm-svn: 46399
2008-01-26 12:33:01 +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
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
Evan Cheng
ca434b34ff
Test case for varargs parameter attribute issue I just fixed.
...
llvm-svn: 46127
2008-01-17 07:26:31 +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
Devang Patel
a8d63b0b30
Do not strip llvm.used values.
...
llvm-svn: 46045
2008-01-16 03:33:05 +00:00
Chris Lattner
f0dd2bb4e6
add a test to ensure that argpromote of one argument doesn't
...
break the byval attr on some other argument.
llvm-svn: 46025
2008-01-15 22:38:12 +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
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
32eae5daa5
Fix PR1907, a nasty miscompilation because instcombine didn't
...
realize that ne & sgt was a signed comparison (it was only
looking at whether the left compare was signed).
llvm-svn: 45937
2008-01-13 20:59:02 +00:00
Duncan Sands
7414cc131b
When turning a call to a bitcast function into a direct call,
...
if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.
llvm-svn: 45931
2008-01-13 08:02:44 +00:00
Chris Lattner
d90840eddc
we don't have to make an explicit copy of a byval argument when
...
inlining a function if we know that the function does not write
to *any* memory. This implements test/Transforms/Inline/byval2.ll
llvm-svn: 45912
2008-01-12 18:54:29 +00:00
Duncan Sands
6f49217a5e
When DAE drops the varargs part of a function, ensure any
...
attributes on the vararg call arguments are also dropped.
llvm-svn: 45892
2008-01-11 23:13:45 +00:00
Chris Lattner
a1246ba8ed
Teach argpromote to ruthlessly hack small byval structs when it can
...
get away with it, which exposes opportunities to eliminate the memory
objects entirely. For example, we now compile byval.ll to:
define internal void @f1(i32 %b.0, i64 %b.1) {
entry:
%tmp2 = add i32 %b.0, 1 ; <i32> [#uses=0]
ret void
}
define i32 @main() nounwind {
entry:
call void @f1( i32 1, i64 2 )
ret i32 0
}
This seems like it would trigger a lot for code that passes around small
structs (e.g. SDOperand's or _Complex)...
llvm-svn: 45886
2008-01-11 22:31:41 +00:00
Chris Lattner
bf51fecdc4
When inlining a functino with a byval argument, make an explicit
...
copy of it in case the callee modifies the struct.
llvm-svn: 45853
2008-01-11 06:09:30 +00:00
Chris Lattner
67f581b344
Implement PR1795, an instcombine hack for forming GEPs with integer pointer arithmetic.
...
llvm-svn: 45745
2008-01-08 07:23:51 +00:00
Duncan Sands
fd975e4b3d
The transform that tries to turn calls to bitcast functions into
...
direct calls bails out unless caller and callee have essentially
equivalent parameter attributes. This is illogical - the callee's
attributes should be of no relevance here. Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.
llvm-svn: 45658
2008-01-06 18:27:01 +00:00
Duncan Sands
b8489f09a2
When transforming a call to a bitcast function into
...
a direct call with cast parameters and cast return
value (if any), instcombine was prepared to cast any
non-void return value into any other, whether castable
or not. Add a new predicate for testing whether casting
is valid, and check it both for the return value and
(as a cleanup) for the parameters.
llvm-svn: 45657
2008-01-06 10:12:28 +00:00
Chris Lattner
7e1c3aa702
remove a couple more unsafe xforms in the face of overflow.
...
llvm-svn: 45613
2008-01-05 01:22:42 +00:00
Chris Lattner
d4c66656a1
Fix PR1896
...
llvm-svn: 45568
2008-01-04 05:04:53 +00:00
Chris Lattner
26b89fd30a
don't hoist FP additions into unconditional adds + selects. This
...
could theoretically introduce a trap, but is also a performance issue.
This speeds up ptrdist/ks by 8%.
llvm-svn: 45533
2008-01-03 07:25:26 +00:00
Bill Wendling
e6898cbe7a
Update this testcase. The output needs to be disabled to pass.
...
llvm-svn: 45478
2008-01-01 01:34:36 +00:00
Chris Lattner
2369d2f4ab
dead calls to llvm.stacksave can be deleted, even though they
...
have potential side-effects.
llvm-svn: 45392
2007-12-29 00:59:12 +00:00
Chris Lattner
e26989231e
upgrade this test
...
llvm-svn: 45391
2007-12-29 00:57:06 +00:00
Devang Patel
d601ada369
Test -simplifycfg only.
...
llvm-svn: 45389
2007-12-28 22:59:48 +00:00
Owen Anderson
ddb5d73f0a
Add a testcase for my recent InstCombine fix, written by Nicholas.
...
llvm-svn: 45386
2007-12-28 21:08:43 +00:00
Chris Lattner
d64df490ca
implement InstCombine/shift-trunc-shift.ll. This allows
...
us to compile:
#include <math.h>
int t1(double d) { return signbit(d); }
into:
_t1:
movd %xmm0, %rax
shrq $63, %rax
ret
instead of:
_t1:
movd %xmm0, %rax
shrq $32, %rax
shrl $31, %eax
ret
on x86-64.
llvm-svn: 45311
2007-12-22 09:07:47 +00:00
Devang Patel
e035f776e9
If succ has succ itself as one of the predecessors then do
...
not merge current bb and succ even if bb's terminator is
unconditional branch to succ.
llvm-svn: 45305
2007-12-22 01:32:53 +00:00
Duncan Sands
85ca85c070
Make DAE not wipe out attributes on calls, and not drop
...
return attributes on the floor. In the case of a call
to a varargs function where the varargs arguments are
being removed, any call attributes on those arguments
need to be dropped. I didn't do this because I plan to
make it illegal to have such attributes (see next patch).
With this change, compiling the gcc filter2 eh test at -O0
and then running opt -std-compile-opts on it results in
a correctly working program (compiling at -O1 or higher
results in the test failing due to a problem with how we
output eh info into the IR).
llvm-svn: 45285
2007-12-21 19:16:16 +00:00
Christopher Lamb
7ca648a7b1
Implement review feedback, including additional transforms
...
(icmp slt (sub A B) 1) -> (icmp sle A B)
icmp sgt (sub A B) -1) -> (icmp sge A B)
and add testcase.
llvm-svn: 45256
2007-12-20 07:21:11 +00:00