[llvm-commits] add EP_OptimizerLast

Chris Lattner clattner at apple.com
Fri Mar 23 14:51:12 PDT 2012


On Mar 23, 2012, at 2:11 PM, Kostya Serebryany wrote:

> Hello, 
> 
> Please review the following patch that adds extension point "EP_OptimizerLast" to PassManagerBuilder.
> 
> Currently, ThreadSanitizer instrumentation pass (which is a FunctionPass, not a ModulePass) runs as EP_ScalarOptimizerLate.
> As the result it instruments functions before inlining, which is wrong. 
> Once this patch is in, I'll change ThreadSanitizer to run at EP_OptimizerLast, so that it kicks in after inlining (really last).

This looks fine to me,

-Chris


> 
> An alternative to this change would be to make ThreadSanitizer a ModulePass (kind of sad). 
> 
> Thanks, 
> 
> --kcc 
> 
> Index: lib/Transforms/IPO/PassManagerBuilder.cpp
> ===================================================================
> --- lib/Transforms/IPO/PassManagerBuilder.cpp   (revision 153188)
> +++ lib/Transforms/IPO/PassManagerBuilder.cpp   (working copy)
> @@ -202,6 +202,7 @@
>      if (OptLevel > 1)
>        MPM.add(createConstantMergePass());     // Merge dup global constants
>    }
> +  addExtensionsToPM(EP_OptimizerLast, MPM);
>  }
>  
>  void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
> Index: include/llvm/Transforms/IPO/PassManagerBuilder.h
> ===================================================================
> --- include/llvm/Transforms/IPO/PassManagerBuilder.h    (revision 153188)
> +++ include/llvm/Transforms/IPO/PassManagerBuilder.h    (working copy)
> @@ -73,6 +73,10 @@
>      /// cleanup-ish optimizations.
>      EP_ScalarOptimizerLate,
>  
> +    /// EP_OptimizerLast -- This extension point allows adding passes that
> +    /// run after everything else.
> +    EP_OptimizerLast,
> +
>      /// EP_EnabledOnOptLevel0 - This extension point allows adding passes that
>      /// should not be disabled by O0 optimization level. The passes will be
>      /// inserted after the inlining pass.
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list