[LLVMdev] Interactions between module and loop passes

Pablo Barrio pbarrio at die.upm.es
Fri Mar 2 09:14:30 PST 2012


Hi Duncan,
> Hi Pablo,
>
>> I have a code with three passes (one loop pass and two module passes)
>> and my own pass manager. If I schedule the loop pass between the others,
>> my code segfaults.
> when developing with LLVM you should configure with --enable-assertions.
> That way you should get an assert failure with a helpful message rather
> than a crash.
Sorry, I forgot to add the assertion failure:

PassManager.cpp:540: void llvm::PMTopLevelManager::setLastUser(const 
llvm::SmallVectorImpl<llvm::Pass*>&, llvm::Pass*): Assertion 
`AnalysisPass && "Expected analysis pass to exist."' failed.

> class ModPass1 : public ModulePass{
>
>        virtual void getAnalysisUsage(AnalysisUsage&AU) const{
>            AU.setPreservesAll();
>        }
> };
>
> class LoopPass : public LoopPass{
>
> 	virtual void getAnalysisUsage(AnalysisUsage&AU) const{
> 		AU.setRequires<ModPass1>();
> I'm pretty sure a LoopPass cannot require a ModulePass.
Is it possible to overcome this limitation? I need to access and modify 
the loops in a function. Is it possible to do that from the function 
itself, or is the loop pass the only way to get Loop objects? If I can 
do it from a Module (or another) pass, I don't mind. Loop passes just 
sound to me like the most straightforward way.

Thanks for your time,

-- 
Pablo Barrio
Dpt. Electrical Engineering - Technical University of Madrid
Office C-203
Avda. Complutense s/n, 28040 Madrid
Tel. (+34) 915495700 ext. 4234
@: pbarrio at die.upm.es




More information about the llvm-dev mailing list