Commit Graph

18 Commits

Author SHA1 Message Date
Duncan Sands 9759f2e063 Fix PR3754: don't mark functions that wrap MallocInst with
the readnone.  Since MallocInst is scheduled for deletion
it doesn't seem worth doing anything more subtle, such as
having mayWriteToMemory return true for MallocInst.

llvm-svn: 71077
2009-05-06 08:42:00 +00:00
Duncan Sands 5cbd3d9c52 This debug info special case should no longer
be needed now that these intrinsics are marked
as not accessing memory.

llvm-svn: 66420
2009-03-09 11:57:08 +00:00
Nick Lewycky 9ec96d19e3 Fix comments, pointed out by Duncan Sands.
llvm-svn: 66381
2009-03-08 17:08:09 +00:00
Nick Lewycky fbed86a865 Mark function returns as noalias.
llvm-svn: 66369
2009-03-08 06:20:47 +00:00
Devang Patel cc40a61af7 Ignore debug info intrinsics.
llvm-svn: 65908
2009-03-03 00:28:44 +00:00
Duncan Sands e0aa0d677d 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
Duncan Sands 289f59f233 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 94bcbbab74 Reorder these.
llvm-svn: 61873
2009-01-07 19:17:02 +00:00
Duncan Sands 02599850b4 Use a switch rather than a sequence of "isa" tests.
llvm-svn: 61872
2009-01-07 19:10:21 +00:00
Nick Lewycky 1d805c62c4 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 c7affb0a8f 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 b193a37cd3 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
Duncan Sands cefc8604aa Improve comments and reorganize a bit - no functionality
change.

llvm-svn: 61569
2009-01-02 11:46:24 +00:00
Nick Lewycky 7e82055e88 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.

llvm-svn: 61552
2009-01-02 03:46:56 +00:00
Duncan Sands 1f11d2bbc1 Mention that this pass does escape analysis in the
leading comments.

llvm-svn: 61548
2009-01-01 20:45:19 +00:00
Duncan Sands 163848021b Look through phi nodes and select instructions when
calculating nocapture attributes.

llvm-svn: 61535
2008-12-31 20:21:34 +00:00
Duncan Sands df128eb477 Don't analyze arguments already marked 'nocapture'.
llvm-svn: 61532
2008-12-31 18:08:59 +00:00
Duncan Sands 44c8cd97a5 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'.

llvm-svn: 61525
2008-12-31 16:14:43 +00:00