Matthijs Kooijman
b7e2818227
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
8177832230
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
bb59138fa6
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
4be2e72cc5
revert recent patch which is causing widespread breakage.
...
llvm-svn: 52415
2008-06-17 17:06:43 +00:00
Matthijs Kooijman
dd32cb58b5
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
f0adaf34a1
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
7864575654
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
775c91b2f5
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
df97b7b4a2
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
8e980a31d5
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
a03f85df05
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
861df1986d
Use eraseFromParent() instead of doing that manually in two places.
...
llvm-svn: 51770
2008-05-30 12:35:46 +00:00
Gabor Greif
b320ae0f07
convert more operand loops to iterator formulation
...
llvm-svn: 51663
2008-05-29 01:59:18 +00:00
Duncan Sands
4757a8dd76
Fix some constructs that gcc-4.4 warns about.
...
llvm-svn: 51591
2008-05-27 11:50:51 +00:00
Duncan Sands
fa995d7cc5
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
c4ddb73290
Indent fix.
...
llvm-svn: 51477
2008-05-23 07:57:02 +00:00
Dan Gohman
698b435f13
Use isSingleValueType instead of isFirstClassType to
...
exclude struct and array types.
llvm-svn: 51459
2008-05-23 00:17:26 +00:00
Dan Gohman
8df50ad902
Use isSingleValueType instead of isFirstClassType to
...
exclude struct and array types.
llvm-svn: 51456
2008-05-23 00:12:03 +00:00
Dale Johannesen
415dc434d6
Less conservative verison of previous patch,
...
suggested by Duncan.
llvm-svn: 51211
2008-05-16 23:18:52 +00:00
Dale Johannesen
b2411740b7
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
d61f20217a
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
48ffb6c7dc
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
047ba6df54
Simplify internalize pass. Add test case.
...
Patch by Matthijs Kooijman!
llvm-svn: 51114
2008-05-14 20:01:01 +00:00
Nate Begeman
b4412e7652
80 col / tabs fixes
...
llvm-svn: 51021
2008-05-13 01:48:26 +00:00
Dan Gohman
bab18cae46
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
Duncan Sands
dd33da4795
Fix a type and formatting.
...
llvm-svn: 50900
2008-05-09 12:20:10 +00:00
Gordon Henriksen
846171a09e
Improve pass documentation and comments.
...
Patch by Matthijs Kooijman!
llvm-svn: 50861
2008-05-08 17:46:35 +00:00
Devang Patel
3dce0e9d2e
Check linkage.
...
llvm-svn: 50851
2008-05-08 15:08:39 +00:00
Dan Gohman
d4a670284c
Make several variable declarations static.
...
llvm-svn: 50696
2008-05-06 01:53:16 +00:00
Chris Lattner
be2bafbe92
Delete the IPO simplify-libcalls and completely reimplement it as
...
a FunctionPass. This makes it simpler, fixes dozens of bugs, adds
a couple of minor features, and shrinks is considerably: from
2214 to 1437 lines.
llvm-svn: 50520
2008-05-01 06:25:24 +00:00
Chris Lattner
844e32537d
use string length computation to generalize several xforms.
...
llvm-svn: 50464
2008-04-30 03:07:53 +00:00
Chris Lattner
5e47b186a7
Implement more aggressive support for analyzing string length. This
...
generalizes the previous code to handle the case when the string is not
an immediate to the strlen call (for example, crazy stuff like
strlen(c ? "foo" : "bart"+1) -> 3). This implements
gcc.c-torture/execute/builtins/strlen-2.c. I will generalize other
cases in simplifylibcalls to use the same routine later.
llvm-svn: 50408
2008-04-29 06:56:02 +00:00
Chris Lattner
2798e42a9f
When SRoA'ing a global variable, make sure the new globals get the
...
appropriate alignment. This fixes a miscompilation of 252.eon on
x86-64 (rdar://5891920).
Bill, please pull this into Tak.
llvm-svn: 50308
2008-04-26 07:40:11 +00:00
Nick Lewycky
1f831c0f57
Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
...
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.
llvm-svn: 50265
2008-04-25 16:53:59 +00:00
Chris Lattner
bc79442313
simplify code for propagation of constant arguments into
...
callees.
llvm-svn: 50142
2008-04-23 06:16:27 +00:00
Chris Lattner
408b51d214
Fix a number of bugs in ipconstantprop, simplify the code, fit in 80 cols,
...
fix read after free bug (PR2238).
llvm-svn: 50141
2008-04-23 05:59:23 +00:00
Chris Lattner
ca82082080
don't assume that the argument passed to fprintf("%s" is a string. This
...
fixes a crash in opt on 433.milc.
llvm-svn: 50023
2008-04-21 03:18:33 +00:00
Chris Lattner
d299f7b8cf
Allow argpromote to promote struct arguments with a specified number
...
of elements. Patch by Matthijs Kooijman!
llvm-svn: 49962
2008-04-19 19:50:01 +00:00
Chris Lattner
0bd4d7eef1
Disable an xform we've had for a long time, pow(x,0.5) -> sqrt.
...
This is not safe for all inputs.
llvm-svn: 49458
2008-04-10 02:07:51 +00:00
Chris Lattner
be01a5f699
Generalize getUnaryFloatFunction to handle any FP unary function, automatically
...
figuring out the suffix to use. implement pow(2,x) -> exp2(x).
llvm-svn: 49437
2008-04-09 17:48:11 +00:00
Chris Lattner
0eb93cf8d0
use the new ConstantFP::get method to make this work with
...
long double and simplify the code.
llvm-svn: 49435
2008-04-09 17:17:35 +00:00
Chris Lattner
976ea8990e
many cleanups to the pow optimizer. Allow it to handle powf,
...
add support for pow(x, 2.0) -> x*x.
llvm-svn: 49411
2008-04-09 00:07:45 +00:00
Duncan Sands
64f15131d8
Use Intrinsic::getDeclaration in more places.
...
llvm-svn: 49338
2008-04-07 13:45:04 +00:00
Gabor Greif
6c6b8a57f3
API changes for class Use size reduction, wave 1.
...
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.
llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Evan Cheng
8a61b02bd8
1. Drop default inline threshold back down to 200.
...
2. Do not use # of basic blocks as part of the cost computation since it doesn't really figure into function size.
3. More aggressively inline function with vector code.
llvm-svn: 49061
2008-04-01 23:59:29 +00:00
Evan Cheng
d01a2a18f8
Increasing the inline limit from (overly conservative) 200 to 300. Given each BB costs 20 and each instruction costs 5, 200 means a 4 BB function + 24 instructions (actually less because caller's size also contributes to it).
...
Furthermore, double the limit when more than 10% of the callee instructions are vector instructions. Multimedia kernels tend to love inlining.
llvm-svn: 48725
2008-03-24 06:37:48 +00:00
Dan Gohman
a363ba510c
Don't include <map> in Pass.h, which doesn't need it. This requires
...
adding <map> to many files that actually do need it.
llvm-svn: 48667
2008-03-21 23:51:57 +00:00
Andrew Lenharth
2ff2bcbde8
FunctionExtractorPass has been superceded by GVExtractorPass
...
llvm-svn: 48648
2008-03-21 16:46:53 +00:00
Devang Patel
192124d0e6
Incorporate feedback.
...
- Fix loop nest.
- Use RetVals.size()
- Check for null return value.
llvm-svn: 48605
2008-03-20 18:30:32 +00:00
Zhou Sheng
fc7856f528
Take the old function's name.
...
llvm-svn: 48588
2008-03-20 08:05:05 +00:00