[llvm-commits] patch: add 'halting' function attribute

Chris Lattner clattner at apple.com
Tue Jul 6 13:54:33 PDT 2010


On Jul 6, 2010, at 1:50 PM, Nick Lewycky wrote:
> >  * a new pass named HaltingAttr is added to mark up functions with the halting attribute. If necessary, it queries SCEV for an upper bound on the loop trip count. It is not an SCC pass.
> 
> Why can't this be done in the existing bottom-up pass for inferring this?
> 
> SCC passes can't depend on FunctionPasses like LoopInfo and SCEV.

I think that having the existing SCC pass propagate the bit from callee to caller where possible makes sense.  How does a function pass know it is going to visit a callee before a caller?  For a function to be "halting" all called functions also have to be known to halt.

> Also, we can't make use of SCC anyhow because two functions that halt locally but also call each other aren't necessarily halting; they could recurse infinitely. However, having the CallGraphNode* is useful to avoid a linear scan looking for CallInst's as it already has the list.

Are you saying that you really have to give up on any non-leaf function?

> Finally, my patch was missing the part where I actually add HaltingAttr to the list of standard passes. I need to think more about where I want to schedule this; I really want it after the loop optimizations but before the inliner makes its decision. A CGSCCPass would be perfect, were it not for the inability to depend on LoopInfo and SCEV.

At the high level, this is the part I'm most concerned with.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100706/b6a158ca/attachment.html>


More information about the llvm-commits mailing list