[LLVMdev] Function Pass Manager

John Criswell criswell at illinois.edu
Tue Jun 5 07:31:24 PDT 2012


On 4/12/12 3:32 AM, Ivan Llopard wrote:
> Hi again,
>
> I come back to this issue with an example. It's a pass which does
> nothing but throw the 'Unable to schedule' error.
>
> namespace {
>     struct MyPass : public FunctionPass {
>       static char ID; // Pass identification, replacement for typeid
>       MyPass() : FunctionPass(ID) {
>         initializeMyPassPass(*PassRegistry::getPassRegistry());
>       }
>       virtual void getAnalysisUsage(AnalysisUsage&AU) const {
>         AU.addRequiredID(LoopSimplifyID);
>         AU.addPreservedID(LoopSimplifyID);
>       }
>       virtual bool runOnFunction(Function&F);
>     };
> }

Is LoopSimplifyID an analysis pass or a transform (optimization) pass?

You cannot reliably use the addRequired() method to force a transform 
pass to run before another pass; there are cases in which the 
PassManager cannot schedule the required passes.  You must simply ensure 
that LoopSimplify is executed before your pass.

-- John T.




More information about the llvm-dev mailing list