[LLVMdev] CallSite in innermost loop

Devang Patel dpatel at apple.com
Wed Nov 16 09:45:55 PST 2011


On Nov 16, 2011, at 2:43 AM, Pankaj Gode wrote:

> In order to detect whether CallSite is present in innermost loop, do I need to insert logic from LoopInfo pass for collecting loops, within a CallGraphSCC pass?
>  
> Is there any other approach for this?
> 

PassManager not only schedules passes, it also 
	- manages memory
	- ensures that analysis info is valid at the point of use
	- eliminates redundant calculation of analysis
	- automatically schedule other required passes
	- takes responsibility of walking program construct. For example, a LoopPass does not need to worry about how to walk loop nest. A FunctionPass does not worry about in which order the functions are processed. 

Right now, CallGraph pass manager is not equipped to satisfy these requirements at loop level. You could certainly extend the PassManager, but it is not structured and designed to support such scenarios.

That does not mean you can not use LoopInfo in your pass. It means, you'll have to manage the memory, satisfy its needs and ensure validity of the info yourself. You could do something like,

	LoopInfo LI;
	DominatorTree DT;

	....
	DT.recalculate(F)
	LI.Calculate(DT.getBase());
	...
	... use LI ...  /* Make sure F is not modified since DT and LI were calculate. */
	...
	DT.releaseMemory();
	LI.releaseMemory();

-
Devang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111116/3da1e43c/attachment.html>


More information about the llvm-dev mailing list