Commit Graph

13 Commits

Author SHA1 Message Date
Duncan Sands
8556d2a7f1 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62461 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-18 12:19:30 +00:00
Duncan Sands
b0cea8ff39 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61876 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 19:39:06 +00:00
Duncan Sands
acf984417f Reorder these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61873 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 19:17:02 +00:00
Duncan Sands
00e7ea98c0 Use a switch rather than a sequence of "isa" tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-07 19:10:21 +00:00
Nick Lewycky
3b3b4e3f0f Any void readonly functions are provably dead, don't waste time adding
nocapture attributes to them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-03 17:05:32 +00:00
Duncan Sands
9c5a5b01b4 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 15:16:38 +00:00
Duncan Sands
338cd6ba6e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 11:54:37 +00:00
Duncan Sands
b2f2279056 Improve comments and reorganize a bit - no functionality
change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61569 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 11:46:24 +00:00
Nick Lewycky
6b05686283 Make adding nocapture a bit stronger. FreeInst is nocapture. Also,
functions that don't write can't leak a pointer except through 
the return value, so a void readonly function is implicitly nocapture.

Test these, and add a test that verifies that f1 calling f2 with an 
otherwise dead pointer gets both of them marked nocapture.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61552 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-02 03:46:56 +00:00
Duncan Sands
88e76757de Mention that this pass does escape analysis in the
leading comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-01 20:45:19 +00:00
Duncan Sands
1010941954 Look through phi nodes and select instructions when
calculating nocapture attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 20:21:34 +00:00
Duncan Sands
17da06ffbd Don't analyze arguments already marked 'nocapture'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 18:08:59 +00:00
Duncan Sands
9e89ba31f1 Rename AddReadAttrs to FunctionAttrs, and teach it how
to work out (in a very simplistic way) which function
arguments (pointer arguments only) are only dereferenced
and so do not escape.  Mark such arguments 'nocapture'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-31 16:14:43 +00:00