[llvm-commits] patch: fix nocapture deduction in functionattrs pass

Nick Lewycky nicholas at mxc.ca
Fri Dec 23 11:57:42 PST 2011


The deduction of "nocapture" in the FunctionAttrs pass is dependent on 
the incidental iteration order through the functions in an SCC.

I wasn't able to come up with an easy way to fix this efficiently, so I 
ended up implementing a rather gnarly amount of stuff. The attached 
patch now builds up an SCC between the Arguments and uses that to solve 
whether arguments are nocapture or not. This has the same number of 
calls to PointerMayBeCaptured() as before, and that's the really slow 
part, so I'm not too worried about the efficiency of this 
implementation. As a bonus, we'll also start solving nocapture in 
difficult cases.

Please review! Is there really no good way to convert from Use* in a 
CallInst argument-operand to the Function's Argument*? Are there better 
names I could use than ArgumentGraph and ArgumentGraphNode? (An earlier 
draft of this patch named them as use-def chains of Arguments; ArgGraph 
and ArgUseDef.) Am I using GraphTraits<> properly or is there more gunk 
than I need?

Nick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nocapture-argumentscc-1.patch
Type: text/x-patch
Size: 15710 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20111223/b2e3a26d/attachment.bin>


More information about the llvm-commits mailing list