Matthijs Kooijman
79a8eb547c
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
e9af814669
Split DAE::MarkLive into MarkLive and PropagateLiveness.
...
llvm-svn: 53600
2008-07-15 09:00:17 +00:00
Matthijs Kooijman
2ce5709e31
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
f2860b9fb3
Simplify debug code by using RetOrArg::getDescription().
...
llvm-svn: 53598
2008-07-15 08:53:36 +00:00
Matthijs Kooijman
90d08addb0
Fix indentation (intentionally left out of the previous commit).
...
llvm-svn: 53592
2008-07-15 08:47:32 +00:00
Matthijs Kooijman
06642d3812
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
3707f1daba
Use find instead of lower_bound.
...
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Matthijs Kooijman
e0f3ab82c4
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
88ca48b09d
Restore DeadArgElim back to 52570. It's breaking 447.dealII.
...
llvm-svn: 52736
2008-06-25 18:10:09 +00:00
Duncan Sands
1b03c2ac98
Pacify gcc-4.3.
...
llvm-svn: 52723
2008-06-25 16:31:18 +00:00
Matthijs Kooijman
2e2001d8b9
Fix a (false) warning on darwin.
...
llvm-svn: 52705
2008-06-25 08:12:16 +00:00
Matthijs Kooijman
4e1cf1e7d7
Fix some cosmetics in comments.
...
llvm-svn: 52704
2008-06-25 08:10:21 +00:00
Matthijs Kooijman
c702e1d32f
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
19a6469e1b
Rename a few variables to be more consistent.
...
llvm-svn: 52672
2008-06-24 09:14:10 +00:00
Dan Gohman
158ff2c4a9
Use Instruction::eraseFromParent().
...
llvm-svn: 52606
2008-06-21 22:08:46 +00:00
Evan Cheng
33067210d1
Back out Matthijs' DAE patches. It's miscompiling gcc driver.
...
llvm-svn: 52570
2008-06-21 00:31:44 +00:00
Matthijs Kooijman
c456f9dfc6
80 column and trailing whitespace fixes.
...
llvm-svn: 52539
2008-06-20 15:34:07 +00:00
Matthijs Kooijman
0c50b953c5
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
9dc59b7666
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
Matthijs Kooijman
013b6a9a42
Explicitely track if any arguments or return values were removed in
...
DeadArgumentElimination and assert that the function type does not change if
nothing was changed. This should catch subtle changes in function type that are
not intended.
llvm-svn: 52536
2008-06-20 14:28:52 +00:00
Matthijs Kooijman
e91aed6ce1
Remove debug output.
...
llvm-svn: 52535
2008-06-20 14:03:35 +00:00
Matthijs Kooijman
8d32dee428
Recommit r52459, rewriting of the dead argument elimination pass.
...
This is a fixed version that no longer uses multimap::equal_range, which
resulted in a pointer invalidation problem.
Also, DAE::InspectedFunctions was not really necessary, so it got removed.
Lastly, this version no longer applies the extra arg hack on functions who did
not have any arguments to start with.
llvm-svn: 52532
2008-06-20 09:36:16 +00:00
Dan Gohman
d6530872f3
Use the common API for adding instructions to basic blocks instead of
...
using BasicBlock::getInstList.
llvm-svn: 52500
2008-06-19 17:53:32 +00:00
Matthijs Kooijman
0c71732497
Use a CallSite to find the nth argument of a call/invoke instruction instead of
...
using getOperand() directly. This makes things work with invoke instructions as
well.
llvm-svn: 52489
2008-06-19 08:53:24 +00:00
Owen Anderson
9094cc957e
Revert r52459, which was causing an infinite loop or massive slowdown on MultiSource/Applications/SPASS, and possibly others as well.
...
Please reapply once this is fixed.
llvm-svn: 52465
2008-06-18 17:32:16 +00:00
Matthijs Kooijman
964557fdf5
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).
Also add a testcase for testing various variations of (multiple) dead rerturn
values.
llvm-svn: 52459
2008-06-18 11:12:53 +00:00
Matthijs Kooijman
fd17357643
Reapply r52397 (make IPConstProp promote returned arguments), but fixed this
...
time. Sorry for the trouble!
This time, also add a testcase, which I should have done in the first place...
llvm-svn: 52455
2008-06-18 08:30:37 +00:00
Matthijs Kooijman
97034598b1
Reapply r52396, it was unrelated to the breakage (that was caused by r52397, my
...
commit after this).
llvm-svn: 52453
2008-06-18 08:09:27 +00:00
Chris Lattner
aecc3750d1
revert recent patch which is causing widespread breakage.
...
llvm-svn: 52415
2008-06-17 17:06:43 +00:00
Matthijs Kooijman
332836d68d
Learn IPConstProp to propagate arguments that are directly returned. Strictly
...
speaking these are not constant values. However, when a function always returns
one of its arguments, then from the point of view of each caller the return
value is constant (or at least a known value) and can be replaced.
llvm-svn: 52397
2008-06-17 12:20:24 +00:00
Matthijs Kooijman
f03c1ae407
Learn IPConstProp to look at individual return values and propagate them
...
individually.
Also learn IPConstProp how returning first class aggregates work, in addition
to old style multiple return instructions.
Modify the return-constants testscase to confirm this behaviour.
llvm-svn: 52396
2008-06-17 12:02:52 +00:00
Chris Lattner
dbd595f22d
Fix PR2411, where ip constant prop would propagate the
...
result of a weak function.
llvm-svn: 52137
2008-06-09 07:58:07 +00:00
Matthijs Kooijman
e0c5adc158
Let StructRetPromotion check if all if its users are really calls or invokesn,
...
not other instructions. This fixes a crash with the added testcase.
llvm-svn: 51992
2008-06-05 08:57:20 +00:00
Matthijs Kooijman
463f86639d
Let StructRetPromotion check if it's users are really calling it and not
...
passing its pointer. Fixes test with added testcase.
llvm-svn: 51991
2008-06-05 08:48:32 +00:00
Matthijs Kooijman
230d6fbfeb
Use use_iterator::getOperandNo instead of CallSite::hasArgument to check if a
...
function is passed as an argument instead of called. Also do this check a bit
earlier.
llvm-svn: 51990
2008-06-05 08:34:25 +00:00
Matthijs Kooijman
2353f35989
Replace two manual loops with calls to CallSite::hasArguments (no functional changes).
...
llvm-svn: 51947
2008-06-04 16:57:50 +00:00
Matthijs Kooijman
57da7d2308
Use eraseFromParent() instead of doing that manually in two places.
...
llvm-svn: 51770
2008-05-30 12:35:46 +00:00
Gabor Greif
3a9fba5a72
convert more operand loops to iterator formulation
...
llvm-svn: 51663
2008-05-29 01:59:18 +00:00
Duncan Sands
698348dfac
Fix some constructs that gcc-4.4 warns about.
...
llvm-svn: 51591
2008-05-27 11:50:51 +00:00
Duncan Sands
dd7daee850
Factor code to copy global value attributes like
...
the section or the visibility from one global
value to another: copyAttributesFrom. This is
particularly useful for duplicating functions:
previously this was done by explicitly copying
each attribute in turn at each place where a
new function was created out of an old one, with
the result that obscure attributes were regularly
forgotten (like the collector or the section).
Hopefully now everything is uniform and nothing
is forgotten.
llvm-svn: 51567
2008-05-26 19:58:59 +00:00
Matthijs Kooijman
f399bbf980
Indent fix.
...
llvm-svn: 51477
2008-05-23 07:57:02 +00:00
Dan Gohman
30ab45d01e
Use isSingleValueType instead of isFirstClassType to
...
exclude struct and array types.
llvm-svn: 51459
2008-05-23 00:17:26 +00:00
Dan Gohman
7a0566b9cd
Use isSingleValueType instead of isFirstClassType to
...
exclude struct and array types.
llvm-svn: 51456
2008-05-23 00:12:03 +00:00
Dale Johannesen
5610dabac9
Less conservative verison of previous patch,
...
suggested by Duncan.
llvm-svn: 51211
2008-05-16 23:18:52 +00:00
Dale Johannesen
e7f5bc2c3b
Weak functions not declared non-throwing might be
...
replaced at linktime with a body that throws, even
if the body in this file does not. Make PruneEH
be more conservative in this case.
g++.dg/eh/weak1.C
llvm-svn: 51207
2008-05-16 21:31:48 +00:00
Gabor Greif
e1f6e4b21d
API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. Legacy interfaces will be in place for some time. (Merge from use-diet branch.)
...
llvm-svn: 51200
2008-05-16 19:29:10 +00:00
Gabor Greif
697e94cc22
Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
...
llvm-svn: 51143
2008-05-15 10:04:30 +00:00
Devang Patel
f2763e233e
Simplify internalize pass. Add test case.
...
Patch by Matthijs Kooijman!
llvm-svn: 51114
2008-05-14 20:01:01 +00:00
Nate Begeman
53c5c62d6d
80 col / tabs fixes
...
llvm-svn: 51021
2008-05-13 01:48:26 +00:00
Dan Gohman
d78c400b5b
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00