Commit Graph

31 Commits

Author SHA1 Message Date
Chad Rosier 8244b1dc7e Fix intendation.
llvm-svn: 156589
2012-05-10 23:38:07 +00:00
Jakub Staszak 173bce3d2b Move includes to the .cpp file.
llvm-svn: 148342
2012-01-17 22:16:31 +00:00
Nick Lewycky 4c378a4453 Change CaptureTracking to pass a Use* instead of a Value* when a value is
captured. This allows the tracker to look at the specific use, which may be
especially interesting for function calls.

Use this to fix 'nocapture' deduction in FunctionAttrs. The existing one does
not iterate until a fixpoint and does not guarantee that it produces the same
result regardless of iteration order. The new implementation builds up a graph
of how arguments are passed from function to function, and uses a bottom-up walk
on the argument-SCCs to assign nocapture. This gets us nocapture more often, and
does so rather efficiently and independent of iteration order.

llvm-svn: 147327
2011-12-28 23:24:21 +00:00
Nick Lewycky 063ae5897c Fix crasher in GVN due to my recent capture tracking changes.
llvm-svn: 145047
2011-11-21 19:42:56 +00:00
Nick Lewycky aa2a00db35 Add virtual destructor. Whoops!
llvm-svn: 145044
2011-11-21 18:32:21 +00:00
Nick Lewycky 6ae03c3378 Less template, more virtual! Refactoring suggested by Chris in code review.
llvm-svn: 145014
2011-11-20 19:37:06 +00:00
Nick Lewycky 7013a19e8a Refactor capture tracking (which already had a couple flags for whether returns
and stores capture) to permit the caller to see each capture point and decide
whether to continue looking.

Use this inside memdep to do an analysis that basicaa won't do. This lets us
solve another devirtualization case, fixing PR8908!

llvm-svn: 144580
2011-11-14 22:49:42 +00:00
Jay Foad 7c14a558fe Don't include Operator.h from InstrTypes.h.
llvm-svn: 129271
2011-04-11 09:35:34 +00:00
Dan Gohman 88ff1ece63 VAArg doesn't capture its operand.
llvm-svn: 118623
2010-11-09 20:09:35 +00:00
Gabor Greif 7cf6056484 simplify
llvm-svn: 109578
2010-07-28 10:57:28 +00:00
Gabor Greif c78d720f02 rename use_const_iterator to const_use_iterator for consistency's sake
llvm-svn: 99564
2010-03-25 23:06:16 +00:00
Duncan Sands 19d0b47b1f There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy().  Convert most instances of the first form to the second form.
Requested by Chris.

llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Dan Gohman 220b196c94 Reuse the Threshold value to size these containers because it's
currently somewhat convenient for them to have the same value.

llvm-svn: 90980
2009-12-09 18:48:53 +00:00
Dan Gohman 56a5f19c70 Fix a typo in a comment, and adjust SmallSet and SmallVector sizes,
that Chris noticed.

llvm-svn: 90910
2009-12-09 00:28:42 +00:00
Dan Gohman 2d27b191d9 Put a threshold on the number of users PointerMayBeCaptured
examines; fall back to a conservative answer if there are
more. This works around some several compile time problems
resulting from BasicAliasAnalysis calling PointerMayBeCaptured.

The value has been chosen arbitrarily.

This fixes rdar://7438917 and may partially address PR5708.

llvm-svn: 90905
2009-12-08 23:59:12 +00:00
Dan Gohman ff20377740 Use stripPointerCasts(). Thanks Duncan!
llvm-svn: 89472
2009-11-20 19:33:16 +00:00
Dan Gohman a8c144d534 Revert the rule that considers comparisons between two pointers in the
same object to be a non-capture; Duncan pointed out a way that such
a comparison could be a capture.

Make the rule that considers a comparison against null more specific,
and only consider noalias return values compared against null. This
still supports test/Transforms/GVN/nonescaping-malloc.ll, and is not
susceptible to the problem Duncan pointed out with noalias arguments.

llvm-svn: 89468
2009-11-20 17:50:21 +00:00
Dan Gohman 6d919f1613 Simplify this code; it's not necessary to check isIdentifiedObject here
because if the results from getUnderlyingObject match, the values must
be from the same underlying object, even if we don't know what that
object is.

llvm-svn: 89434
2009-11-20 01:34:03 +00:00
Dan Gohman 91449224e8 Refine the capture tracking rules for comparisons to be more
careful about crazy methods of capturing pointers using comparisons.
Comparisons of identified objects with null in the default address
space are not captures. And, comparisons of two pointers within the
same identified object are not captures.

llvm-svn: 89421
2009-11-20 00:50:47 +00:00
Dan Gohman 01956f5a6b Use isVoidTy().
llvm-svn: 89419
2009-11-20 00:43:11 +00:00
Dan Gohman 772f922acb Refine this to only apply to null in the default address space.
llvm-svn: 89411
2009-11-19 23:53:49 +00:00
Dan Gohman 94e617627d Extend CaptureTracking to indicate when a value is never stored, even
if it is not ultimately captured. Teach BasicAliasAnalysis that a 
local object address which does not escape and is never stored does
not alias with a value resulting from a load.

llvm-svn: 89398
2009-11-19 21:57:48 +00:00
Dan Gohman 0a2ba1068e Comparing a pointer with null is not a capture.
llvm-svn: 89389
2009-11-19 21:34:07 +00:00
Chris Lattner e9dccd4934 remove a check of isFreeCall: the argument to free is already nocapture so the generic call code works fine.
llvm-svn: 85865
2009-11-03 05:34:51 +00:00
Victor Hernandez f390e04a47 Rename MallocFreeHelper as MemoryBuiltins
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez 762195bd01 Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez de5ad42aa1 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Owen Anderson 55f1c09e31 Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Duncan Sands 7a8cfafd2e Revert r70876 and add a testcase (@c7) showing the problem:
bits captured, but the pointer marked nocapture.  In fact
I now recall that this problem is why only readnone functions
returning void were considered before!  However keep a small
fix that was also in r70876: a readnone function returning
void can result in bits being captured if it unwinds, so
test for this.

llvm-svn: 71168
2009-05-07 18:08:34 +00:00
Duncan Sands 50c70336b0 Teach capture tracking that readonly functions can
only capture their arguments by returning them or
throwing an exception or not based on the argument
value.  Patch essentially by Frits van Bommel.

llvm-svn: 70876
2009-05-04 16:50:29 +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