[llvm-commits] Pass manager bug fix

Andrew Trick atrick at apple.com
Mon Aug 29 14:25:05 PDT 2011


Checked in as r138737.

Thanks for the fix!

-Andy

On Aug 25, 2011, at 3:25 PM, Guo, Xiaoyi wrote:

> Please review the attached fix for a problem in the pass manager, and commit if acceptable. The fix is against TOT and has passed regression tests.
>  
> The problem is in the assignPassManager() methods. For example, in LoopPass::assignPassManager():
>  
>     // Create new Loop Pass Manager if it does not exist.
>     assert (!PMS.empty() && "Unable to create Loop Pass Manager");
>     PMDataManager *PMD = PMS.top();
>  
>     // [1] Create new Call Graph Pass Manager
>     LPPM = new LPPassManager();
>     LPPM->populateInheritedAnalysis(PMS);
>  
>     // [2] Set up new manager's top level manager
>     PMTopLevelManager *TPM = PMD->getTopLevelManager();
>     TPM->addIndirectPassManager(LPPM);
>  
>     // [3] Assign manager to manage this new manager. This may create
>     // and push new managers into PMS
>     Pass *P = LPPM->getAsPass();
>     TPM->schedulePass(P);
>  
>     // [4] Push new manager into PMS
>     PMS.push(LPPM);
>  
>  
> Step 3 above may create and push new managers into PMS, in which case the Depth of LPPM will no longer be correct. This may in turn cause other things to go wrong. For example, it may cause some analysis passes to be freed prematurely and cause crash.
>  
> My fix is to not set the depth of a pass manager until it is pushed onto the stack.
>  
> Regards,
> Xiaoyi
> <PassManager.diff>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

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


More information about the llvm-commits mailing list