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

908 Commits

Author SHA1 Message Date
Duncan Sands
fdfa2d24fe Delete the removeCallEdgeTo callgraph method,
because it does not maintain a correct list
of callsites.  I discovered (see following
commit) that the inliner will create a wrong
callgraph if it is fed a callgraph with
correct edges but incorrect callsites.  These
were created by Prune-EH, and while it wasn't
done via removeCallEdgeTo, it could have been
done via removeCallEdgeTo, which is an accident
waiting to happen.  Use removeCallEdgeFor
instead.

llvm-svn: 55859
2008-09-05 21:43:04 +00:00
Duncan Sands
b63fde1edb Use removeAllCalledFunctions rather than removing
edges one by one by hand.

llvm-svn: 55836
2008-09-05 14:56:53 +00:00
Duncan Sands
8de0cd8f10 Make this pass return that it made a change if
it modifies a functions attributes.

llvm-svn: 55831
2008-09-05 09:08:37 +00:00
Andrew Lenharth
4523deb38b try to seperate the mechanism into something others can use
llvm-svn: 55785
2008-09-04 18:51:26 +00:00
Dan Gohman
e1f9be27bc Tidy up several unbeseeming casts from pointer to intptr_t.
llvm-svn: 55779
2008-09-04 17:05:41 +00:00
Andrew Lenharth
9e27a7b4b0 cleanup as per Duncan's review
llvm-svn: 55766
2008-09-04 14:34:22 +00:00
Devang Patel
49483d797e Update inline threshold for current function if the notes say, optimize for size.
llvm-svn: 55745
2008-09-03 23:06:09 +00:00
Andrew Lenharth
4a69775c64 Initial version of a Partial Specialization IPO pass. It triggers a couple hundred times on 176.gcc. I don't know the performance impact yet, the heuristic is quite simple still.
llvm-svn: 55734
2008-09-03 21:00:28 +00:00
Devang Patel
41331065dd Fix typo in a comment.
llvm-svn: 55720
2008-09-03 20:25:40 +00:00
Devang Patel
b25dcdea78 Add parentheses to make code more readable.
llvm-svn: 55717
2008-09-03 19:57:15 +00:00
Devang Patel
24618c5a6a Fix comments.
llvm-svn: 55716
2008-09-03 19:52:17 +00:00
Devang Patel
c70392bfcd Add custom inliner that handles only functions that are marked as always_inline.
llvm-svn: 55713
2008-09-03 18:50:53 +00:00
Devang Patel
42fe8ff6e8 Handle "always inline" note during inline cost analysis.
llvm-svn: 55712
2008-09-03 18:47:45 +00:00
Devang Patel
dae7f0b9d7 Check noinline note and ignore other notes.
llvm-svn: 55711
2008-09-03 18:46:35 +00:00
Devang Patel
653bcea20d Handle "noinline" note inside the simple inliner.
llvm-svn: 55708
2008-09-03 18:10:21 +00:00
Devang Patel
5659d2508e s/FP_AlwaysInline/FN_NOTE_AlwaysInline/g
llvm-svn: 55676
2008-09-02 22:43:57 +00:00
Devang Patel
cda9086d29 respect inline=never and inline=always notes.
llvm-svn: 55673
2008-09-02 22:16:13 +00:00
Dan Gohman
027326ba3e Use empty() instead of begin() == end().
llvm-svn: 54780
2008-08-14 18:13:49 +00:00
Matthijs Kooijman
3bbc2deb9c Replace two for loops with while(!X->use_empty()) loops. This prevents
invalidating the iterator by deleting the current use. This fixes a segfault on
64 bit linux reported in PR2675.

Also remove an unneeded if.

llvm-svn: 54778
2008-08-14 15:03:05 +00:00
Bill Wendling
d910182ca9 Remove tabs.
llvm-svn: 54707
2008-08-12 23:15:44 +00:00
Matthijs Kooijman
d62ee008d1 Let SRETPromotion properly preserve the function name instead of (implicitly)
postfixing it with a number.

llvm-svn: 54468
2008-08-07 16:01:23 +00:00
Matthijs Kooijman
287cca11b3 Fix SRETPromotion, it was generating functions without returns statements since
r53941 (but this was not noticed due to the lack of a basic test for
SRETPromotion). 

llvm-svn: 54467
2008-08-07 15:58:09 +00:00
Matthijs Kooijman
9ff5c484cf Add some debug output to SRETPromotion.
llvm-svn: 54464
2008-08-07 15:14:04 +00:00
Matthijs Kooijman
77948dbbc2 Restructure ArgumentPromotion a bit. Instead of just having a single boolean
that says "unconditional loads from this argument are safe", we now keep track
of the safety per set of indices from which loads happen. This prevents
ArgPromotion from promoting loads that aren't really valid. As an added effect,
this will now disregard the the type of the indices passed to a GEP, so
"load GEP %A, i32 1" and "load GEP %A, i64 1" will result in a single argument,
not two.

This fixes PR2598, for which a testcase has been added as well.

llvm-svn: 54159
2008-07-29 10:00:13 +00:00
Dan Gohman
6564581be0 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.

llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Matthijs Kooijman
5ec5e264e4 Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
llvm-svn: 53716
2008-07-17 11:59:53 +00:00
Matthijs Kooijman
f9532fe71b Allow deadargelim to change return types even though now values were dead. This
again canonicalizes {i32} into i32 and {} into void.

llvm-svn: 53610
2008-07-15 14:42:31 +00:00
Matthijs Kooijman
18c6979fed Revert r53606. It turns out that explicitely tracking the liveness of the
return value as a whole in deadargelim is really not needed now that we simply
rebuild the old return value and actually prevents some canonicalization from
taking place.

This revert stops deadargelim from changing {i32} into i32 for now, but I'll
fix that next.

llvm-svn: 53609
2008-07-15 14:39:36 +00:00
Matthijs Kooijman
f940585c1c Make deadargelim a bit less smart, so it doesn't choke on nested structs as
return values that are still (partially) live. Instead of updating all uses of
a call instruction after removing some elements, it now just rebuilds the
original struct (With undef gaps where the unused values were) and leaves it to
instcombine to clean this up.

The added testcase still fails currently, but this is due to instcombine which
isn't good enough yet. I will fix that part next.

llvm-svn: 53608
2008-07-15 14:03:10 +00:00
Matthijs Kooijman
50a2233b45 Don't use isa when we can reuse a previous dyn_cast.
llvm-svn: 53607
2008-07-15 13:39:08 +00:00
Matthijs Kooijman
4b75601340 Make DeadArgElim keep liveness of the return value as a whole in addition to
only the liveness of partial return values (for functions returning a struct).
This is more explicit to prevent unwanted changes in the return value. 

In particular, deadargelim now canonicalizes a function returning {i32} to
returning i32 and {} to void, if the struct returned is not used in its
entirety, but only the single element is used.

llvm-svn: 53606
2008-07-15 13:36:06 +00:00
Matthijs Kooijman
86a46174fe Let DAE keep a list of live functions, instead of simply marking all arguments
and return values live for those functions. This doesn't change anything yet,
but prepares for the coming commits.

llvm-svn: 53601
2008-07-15 09:11:16 +00:00
Matthijs Kooijman
caa3ed0c99 Split DAE::MarkLive into MarkLive and PropagateLiveness.
llvm-svn: 53600
2008-07-15 09:00:17 +00:00
Matthijs Kooijman
31b7208f7d Pass around const RetOrArg references instead of copying values. Also, mark
RetOrArg::getDescription() as const.

llvm-svn: 53599
2008-07-15 08:56:49 +00:00
Matthijs Kooijman
937016427b Simplify debug code by using RetOrArg::getDescription().
llvm-svn: 53598
2008-07-15 08:53:36 +00:00
Matthijs Kooijman
c9c8644910 Fix indentation (intentionally left out of the previous commit).
llvm-svn: 53592
2008-07-15 08:47:32 +00:00
Matthijs Kooijman
52acc10fdc Move the deadargelim code for intrinsically alive functions into its own
method, to slightly simplify control flow.

llvm-svn: 53591
2008-07-15 08:45:12 +00:00
Dan Gohman
d1342570f2 Use find instead of lower_bound.
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Matthijs Kooijman
ca5124a630 Restructure dead argument elimination, try #3 :-)
Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.

The pass now looks properly inside returned structs, but only at the first
level (ie, not inside nested structs).

This version fixed a few more bugs and was cleaned up a bit. It now passes all
of LLVM's testing, and should still pass SPEC2006. There is still a minor bug
with regard to returning nested structs. Since there is currently nothing that
emits such IR, I will fix that in a seperate commit (partly because it requires
a non-trivial fix).

llvm-svn: 53400
2008-07-10 10:24:08 +00:00
Evan Cheng
5ed0e42cc3 Restore DeadArgElim back to 52570. It's breaking 447.dealII.
llvm-svn: 52736
2008-06-25 18:10:09 +00:00
Duncan Sands
93aacd5b48 Pacify gcc-4.3.
llvm-svn: 52723
2008-06-25 16:31:18 +00:00
Matthijs Kooijman
45bffc6580 Fix a (false) warning on darwin.
llvm-svn: 52705
2008-06-25 08:12:16 +00:00
Matthijs Kooijman
9b78534b71 Fix some cosmetics in comments.
llvm-svn: 52704
2008-06-25 08:10:21 +00:00
Matthijs Kooijman
ff03ea8aeb Commit the new DeadArgElim pass again, this time with the gcc bootstrap failures fixed.
Also add a testcase to reproduce the gcc bootstrap failure in very much reduced form.

llvm-svn: 52677
2008-06-24 16:30:26 +00:00
Matthijs Kooijman
bb456f6b42 Rename a few variables to be more consistent.
llvm-svn: 52672
2008-06-24 09:14:10 +00:00
Dan Gohman
91a43b082c Use Instruction::eraseFromParent().
llvm-svn: 52606
2008-06-21 22:08:46 +00:00
Evan Cheng
b65bceda9c Back out Matthijs' DAE patches. It's miscompiling gcc driver.
llvm-svn: 52570
2008-06-21 00:31:44 +00:00
Matthijs Kooijman
54efc9f60e 80 column and trailing whitespace fixes.
llvm-svn: 52539
2008-06-20 15:34:07 +00:00
Matthijs Kooijman
7a75a306ff Don't let DeadArgumentElimination attempt to update callers when the return
type wasn't changed.

llvm-svn: 52538
2008-06-20 15:25:43 +00:00
Matthijs Kooijman
9a9a6f1122 Don't let DeadArgElimination change the return type ({} into void and {T}
into T) when no return values are actually dead.

llvm-svn: 52537
2008-06-20 15:16:45 +00:00