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

1030 Commits

Author SHA1 Message Date
Nick Lewycky
55ff36a552 Keep calling-convention and tail-call bit when creating new invoke or call.
llvm-svn: 66384
2009-03-08 19:02:17 +00:00
Nick Lewycky
5355d525f8 Fix comments, pointed out by Duncan Sands.
llvm-svn: 66381
2009-03-08 17:08:09 +00:00
Nick Lewycky
365f21b20f Mark function returns as noalias.
llvm-svn: 66369
2009-03-08 06:20:47 +00:00
Chris Lattner
7ddad92288 use MemTransferInst.
llvm-svn: 66362
2009-03-08 03:37:35 +00:00
Chris Lattner
fc43115972 fix a serious pessimization that Tron on IRC pointed out where we would
"boolify" pointers, generating really awful code because getting the pointer
value requires a load itself.  Before:

_foo:
	movb	$1, _X.b
	ret
_get:
	xorl	%ecx, %ecx
	movb	_X.b, %al
	testb	%al, %al
	movl	$_Y, %eax
	cmove	%ecx, %eax
	ret

With the xform disabled:

_foo:
	movl	$_Y, _X
	ret
_get:
	movl	_X, %eax
	ret

llvm-svn: 66351
2009-03-07 23:32:02 +00:00
Duncan Sands
5ab54d488f Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Chris Lattner
c5dba8954e add a bunch more passes to the C bindings (PR3734), patch by
Lennart Augustsson!

llvm-svn: 66272
2009-03-06 16:52:18 +00:00
Duncan Sands
26567dea82 While thinking about the one-definition-rule and trying
to find a tiny mouse hole to squeeze through, it struck
me that globals without a name can be considered internal
since they can't be referenced from outside the current
module.  This patch makes GlobalOpt give them internal
linkage.  Also done for aliases even though they always
have names, since in my opinion anonymous aliases should
be allowed for consistency with global variables and
functions.  So if that happens one day, this code is ready!

llvm-svn: 66267
2009-03-06 10:21:56 +00:00
Devang Patel
c751e83e2b Revert 66224.
llvm-svn: 66233
2009-03-06 01:39:36 +00:00
Devang Patel
205f80b2f3 Revert rev. 66167.
We are still not out of woods yet.

llvm-svn: 66232
2009-03-06 01:37:41 +00:00
Devang Patel
f815005dfb Do not let debug info prevert globalopt from shriking a global vars to boolean.
llvm-svn: 66224
2009-03-06 00:21:00 +00:00
Devang Patel
34889f5bed GlobalOpt only process non constant local GVs while optimizing global vars.
If non constant local GV named A is used by a constant local GV named B (e.g. llvm.dbg.variable) and B is not used by anyone else then eliminate A as well as B.

In other words, debug info should not interfere in removal of unused GV.
--This life, and those below, will be ignored--

M    test/Transforms/GlobalOpt/2009-03-03-dbg.ll
M    lib/Transforms/IPO/GlobalOpt.cpp

llvm-svn: 66167
2009-03-05 18:12:02 +00:00
Bill Wendling
2eef9340a8 Temporarily revert r65994. It was causing rdar://6646455.
llvm-svn: 66083
2009-03-04 22:02:09 +00:00
Devang Patel
94ef615585 If a global constant is dead then global's debug info should not prevent the optimizer in deleting the global. And while deleting global, delete global's debug info also.
llvm-svn: 65994
2009-03-04 01:22:23 +00:00
Devang Patel
9b7c78086b Recursively remove dead argument while removing llvm.dbg.declare intrinsic.
llvm-svn: 65971
2009-03-03 21:31:02 +00:00
Devang Patel
b69b449ce8 Ignore debug info intrinsics.
llvm-svn: 65908
2009-03-03 00:28:44 +00:00
Devang Patel
5220700e0d Remove all dbg symobls, including those with circular references.
This is ugly, but I can't figure out a quick way out of this.

llvm-svn: 65889
2009-03-02 22:50:58 +00:00
Duncan Sands
d1fef83598 In theory the aliasee may have dead constant users
here.  Since we only do the transform if there is
one use, strip off any such users in the hope of
making the transform fire more often.

llvm-svn: 64926
2009-02-18 17:55:38 +00:00
Dan Gohman
30770ee7b3 Add explicit keywords.
llvm-svn: 64915
2009-02-18 16:37:45 +00:00
Duncan Sands
e605b83258 If an alias is dead and so is its aliasee, then globaldce would
crash because the alias would still be using the aliasee when the
aliasee was deleted.

llvm-svn: 64844
2009-02-17 23:05:26 +00:00
Duncan Sands
c0436287c2 This transform also applies to private linkage.
llvm-svn: 64773
2009-02-17 17:50:04 +00:00
Duncan Sands
6c1ce1dbd5 Make this more useful for cleaning up after the
one-definition-rule llvm-gcc changes (coming soon
to a tree near you!).

llvm-svn: 64588
2009-02-15 11:54:49 +00:00
Duncan Sands
0e6fcb078c If the target of an alias has internal linkage, then the
alias can be morphed into the target.  Implement this
transform, and fix a crash in the existing transform at
the same time.

llvm-svn: 64583
2009-02-15 09:56:08 +00:00
Duncan Sands
aee16d4916 Rename getAnalysisToUpdate to getAnalysisIfAvailable.
llvm-svn: 63198
2009-01-28 13:14:17 +00:00
Nick Lewycky
459667b48d The function that does nothing but call malloc is noalias return.
llvm-svn: 62956
2009-01-25 07:59:57 +00:00
Gabor Greif
2d7bf2a76c use CallSite::isCalle instead of slow getOperandNo
llvm-svn: 62877
2009-01-23 21:17:04 +00:00
Gabor Greif
fbd40904c1 Simplify the logic of getting hold of a PHI predecessor block.
There is now a direct way from value-use-iterator to incoming block in PHINode's API.
This way we avoid the iterator->index->iterator trip, and especially the costly
getOperandNo() invocation. Additionally there is now an assertion that the iterator
really refers to one of the PHI's Uses.

llvm-svn: 62869
2009-01-23 19:40:15 +00:00
Gabor Greif
d56b0a8c03 introduce a useful abstraction to find out if a Use is in the call position of an instruction
llvm-svn: 62788
2009-01-22 21:35:57 +00:00
Duncan Sands
ddfeabbab7 BasicAliasAnalysis and FunctionAttrs were both
doing very similar pointer capture analysis.
Factor out the common logic.  The new version
is from FunctionAttrs since it does a better
job than the version in BasicAliasAnalysis

llvm-svn: 62461
2009-01-18 12:19:30 +00:00
Rafael Espindola
0aba6c9435 Add the private linkage.
llvm-svn: 62279
2009-01-15 20:18:42 +00:00
Chris Lattner
2461d79aa9 rewrite OptimizeAwayTrappingUsesOfLoads to 1) avoid a temporary
vector and extraneous loop over it, 2) not delete globals used by
phis/selects etc which could actually be useful.  This fixes PR3321.
Many thanks to Duncan for narrowing this down.

llvm-svn: 62201
2009-01-14 00:12:58 +00:00
Duncan Sands
661959b54e Correct a comment.
llvm-svn: 62165
2009-01-13 13:48:44 +00:00
Dale Johannesen
12bb54e183 Enable recursive inlining. Reduce inlining threshold
back to 200; 400 seems to be too high, loses more than
it gains.

llvm-svn: 62107
2009-01-12 22:11:50 +00:00
Duncan Sands
bcdbfb63dc Rename getABITypeSize to getTypePaddedSize, as
suggested by Chris.

llvm-svn: 62099
2009-01-12 20:38:59 +00:00
Dale Johannesen
831246cdbd Increase default inlining aggressiveness in partial
compensation for turning off gcc's inliner.  This gets
us closer to the amount of inlining we were getting before.
It is not a win on everything, of course, but seems to
gain overall.

llvm-svn: 62058
2009-01-11 23:11:00 +00:00
Misha Brukman
71c7e40966 Removed trailing whitespace from Makefiles.
llvm-svn: 61991
2009-01-09 16:44:42 +00:00
Dale Johannesen
eb1316a896 Adjustments to last patch based on review.
llvm-svn: 61969
2009-01-09 01:30:11 +00:00
Duncan Sands
3571fbfba8 Whitespace - correct formatting.
llvm-svn: 61879
2009-01-07 20:01:06 +00:00
Duncan Sands
a254acd1d3 Remove alloca tracking from nocapture analysis. Not only
was it not very helpful, it was also wrong!  The problem
is shown in the testcase: the alloca might be passed to
a nocapture callee which dereferences it and returns the
original pointer.  But because it was a nocapture call we
think we don't need to track its uses, but we do.

llvm-svn: 61876
2009-01-07 19:39:06 +00:00
Duncan Sands
ec12740e7a Reorder these.
llvm-svn: 61873
2009-01-07 19:17:02 +00:00
Duncan Sands
2a797fc19a Use a switch rather than a sequence of "isa" tests.
llvm-svn: 61872
2009-01-07 19:10:21 +00:00
Duncan Sands
de5d7e1415 The verifier checks that the aliasee is not null.
llvm-svn: 61870
2009-01-07 18:45:53 +00:00
Duncan Sands
130c00e4b2 Teach the internalize pass to also internalize
global aliases.

llvm-svn: 61754
2009-01-05 21:24:45 +00:00
Duncan Sands
8df2e45948 Not having an aliasee is a theoretical possibility.
llvm-svn: 61745
2009-01-05 20:47:56 +00:00
Duncan Sands
1bd7dc77fd Format more neatly.
llvm-svn: 61744
2009-01-05 20:39:50 +00:00
Duncan Sands
d64956c644 Remove trailing spaces.
llvm-svn: 61743
2009-01-05 20:38:27 +00:00
Duncan Sands
3b98802e9a Delete unused global aliases with internal linkage.
In fact this also deletes those with linkonce linkage,
however this is currently dead because for the moment
aliases aren't allowed to have this linkage type.

llvm-svn: 61742
2009-01-05 20:37:33 +00:00
Nick Lewycky
dfbc53093a Any void readonly functions are provably dead, don't waste time adding
nocapture attributes to them.

llvm-svn: 61610
2009-01-03 17:05:32 +00:00
Duncan Sands
3fee49285c Load tracking means that the value analyzed may
not have pointer type.  In particular, it may
be the condition argument for a select or a GEP
index.  While I was unable to construct a testcase
for which some bits of the original pointer are
captured due to one of these, it's very very close
to being possible - so play safe and exclude these
possibilities.

llvm-svn: 61580
2009-01-02 15:16:38 +00:00
Duncan Sands
c087ba24aa When calculating 'nocapture' argument attributes, allow
the argument to be stored to an alloca by tracking uses
of the alloca.  This occurs 4 times (out of 7121, 0.05%)
in MultiSource/Applications, so may not be worth it.  On
the other hand, it is easy to do and fairly cheap.  The
functions it helps are: W_addcom and W_addlit in spiff;
process_args (argv) in d (make_dparser); ercPixConcealIMB
in JM/ldecod.

llvm-svn: 61570
2009-01-02 11:54:37 +00:00