<div dir="ltr">cc'ed  Chandler directly for comments.<div><br></div><div>David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 15, 2016 at 2:21 PM, Davide Italiano via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Wed, Jun 15, 2016 at 3:22 AM, Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> wrote:<br>
><br>
><br>
</span><div><div class="h5">> On Sun, Jun 12, 2016 at 12:48 AM, Sean Silva via llvm-commits<br>
> <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> Author: silvas<br>
>> Date: Sun Jun 12 02:48:51 2016<br>
>> New Revision: 272505<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=272505&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=272505&view=rev</a><br>
>> Log:<br>
>> [PM] Port ReversePostOrderFunctionAttrs to the new PM<br>
>><br>
>> Below are my super rough notes when porting. They can probably serve as<br>
>> a basic guide for porting other passes to the new PM. As I port more<br>
>> passes I'll expand and generalize this and make a proper<br>
>> docs/HowToPortToNewPassManager.rst document. There is also missing<br>
>> documentation for general concepts and API's in the new PM which will<br>
>> require some documentation.<br>
>> Once there is proper documentation in place we can put up a list of<br>
>> passes that have to be ported and game-ify/crowdsource the rest of the<br>
>> porting (at least of the middle end; the backend is still unclear).<br>
>><br>
>> I will however be taking personal responsibility for ensuring that the<br>
>> LLD/ELF LTO pipeline is ported in a timely fashion. The remaining passes<br>
>> to be ported are (do something like<br>
>> `git grep "<the string in the bullet point below>"` to find the pass):<br>
>><br>
>> General Scalar:<br>
>> [ ] Simplify the CFG<br>
>> [ ] Jump Threading<br>
>> [ ] MemCpy Optimization<br>
>> [ ] Promote Memory to Register<br>
>> [ ] MergedLoadStoreMotion<br>
>> [ ] Lazy Value Information Analysis<br>
>><br>
>> General IPO:<br>
>> [ ] Dead Argument Elimination<br>
>> [ ] Deduce function attributes in RPO<br>
>><br>
>> Loop stuff / vectorization stuff:<br>
>> [ ] Alignment from assumptions<br>
>> [ ] Canonicalize natural loops<br>
>> [ ] Delete dead loops<br>
>> [ ] Loop Access Analysis<br>
>> [ ] Loop Invariant Code Motion<br>
>> [ ] Loop Vectorization<br>
>> [ ] SLP Vectorizer<br>
>> [ ] Unroll loops<br>
>><br>
>> Devirtualization / CFI:<br>
>> [ ] Cross-DSO CFI<br>
>> [ ] Whole program devirtualization<br>
>> [ ] Lower bitset metadata<br>
>><br>
>> CGSCC passes:<br>
>> [ ] Function Integration/Inlining<br>
>> [ ] Remove unused exception handling info<br>
>> [ ] Promote 'by reference' arguments to scalars<br>
><br>
><br>
><br>
> quick update on the status of this list:<br>
><br>
><br>
> General Scalar:<br>
> [x] Simplify the CFG  --> this one was already ported and should not have<br>
> been included in the original list<br>
> [x] Jump Threading<br>
> [x] MemCpy Optimization<br>
> [x] Promote Memory to Register<br>
> [x] MergedLoadStoreMotion<br>
> [x] Lazy Value Information Analysis<br>
><br>
> General IPO:<br>
> [x] Dead Argument Elimination<br>
> [x] Deduce function attributes in RPO<br>
><br>
> Loop stuff / vectorization stuff:<br>
> [x] Alignment from assumptions<br>
> [ ] Canonicalize natural loops --> Should be unblocked for porting.<br>
> [ ] Delete dead loops     --> Blocked on having loop deletion API in new<br>
> loop PM (calls markAsRemoved on LoopInfo)<br>
> [ ] Loop Access Analysis   --> David is working on this one. In progress at<br>
> <a href="http://reviews.llvm.org/D20560" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20560</a>. "depends on preparation work to hide strides<br>
> from the LoopAccessInfo creator interface" which it sounds like Adam Nemet<br>
> will get to this week.<br>
> [ ] Loop Invariant Code Motion --> Should be unblocked for porting.<br>
> [ ] Loop Vectorization      --> Blocked on "Loop Access Analysis"<br>
> [x] SLP Vectorizer<br>
> [ ] Unroll loops    --> Blocked on having loop deletion API in new loop PM<br>
> (calls markAsRemoved on LoopInfo)<br>
><br>
> Devirtualization / CFI:  --> to avoid merge pain, Peter asked us to hold off<br>
> on porting these until his reworking of bitsets is done<br>
> [ ] Cross-DSO CFI<br>
> [ ] Whole program devirtualization<br>
> [ ] Lower bitset metadata<br>
><br>
> CGSCC passes:  --> Exact design of CGSCC is still in the air. Esp. w.r.t.<br>
> what happens when mutating the SCC.<br>
> [ ] Function Integration/Inlining<br>
> [ ] Remove unused exception handling info   ---> This one does not mutate<br>
> the SCC.<br>
> [ ] Promote 'by reference' arguments to scalars<br>
><br>
><br>
><br>
> Updated list is as follows:<br>
><br>
> Loop stuff / vectorization stuff:<br>
> [ ] Canonicalize natural loops --> Should be unblocked for porting.<br>
> [ ] Loop Invariant Code Motion --> Should be unblocked for porting.<br>
> [ ] Loop Access Analysis       --> David is working on this one. In progress<br>
<br>
</div></div>I just ported Canonicalize natural loop (currently under review).<br>
<a href="http://reviews.llvm.org/D21404" rel="noreferrer" target="_blank">http://reviews.llvm.org/D21404</a><br>
<br>
I took a shot at porting LICM today, and noticed that it uses an hook<br>
provided by LPPassManager.<br>
<br>
/// Invoke deleteAnalysisLoop hook for all passes that implement simple<br>
/// analysis interface.<br>
void deleteSimpleAnalysisLoop(Loop *L);<br>
<br>
I think this needs some new API in the new LoopPM (although I'm not 100% sure).<br>
If this is the case, I'd rather classify this as "blocked on new API".<br>
If not, anybody has ideas on how to translate this to the new PM<br>
logic?<br>
<div class="HOEnZb"><div class="h5"><br>
> Blocked on loop deletion API in new PM: --> Blocked on having loop deletion<br>
> API in new loop PM (call markAsRemoved on LoopInfo)<br>
> [ ] Delete dead loops<br>
> [ ] Unroll loops<br>
><br>
> Devirtualization / CFI:  --> to avoid merge pain, Peter asked us to hold off<br>
> on porting these until his reworking of bitsets is done<br>
> [ ] Cross-DSO CFI<br>
> [ ] Whole program devirtualization<br>
> [ ] Lower bitset metadata<br>
><br>
> CGSCC passes:  --> Exact design of CGSCC is still in the air. Esp. w.r.t.<br>
> what happens when mutating the SCC.<br>
> [ ] Function Integration/Inlining<br>
> [ ] Remove unused exception handling info   --> This one does not mutate the<br>
> SCC.<br>
> [ ] Promote 'by reference' arguments to scalars<br>
><br>
> -- Sean Silva<br>
><br>
>><br>
>> Please let me know if you are interested in working on any of the passes<br>
>> in the above list (e.g. reply to the post-commit thread for this patch).<br>
>> I'll probably be tackling "General Scalar" and "General IPO" first FWIW.<br>
>><br>
>> Steps as I port "Deduce function attributes in RPO"<br>
>> ---------------------------------------------------<br>
>><br>
>> (note: if you are doing any work based on these notes, please leave a<br>
>> note in the post-commit review thread for this commit with any<br>
>> improvements / suggestions / incompleteness you ran into!)<br>
>><br>
>> Note: "Deduce function attributes in RPO" is a module pass.<br>
>><br>
>> 1. Do preparatory refactoring.<br>
>><br>
>> Do preparatory factoring. In this case all I had to do was to pull out a<br>
>> static helper (r272503).<br>
>> (TODO: give more advice here e.g. if pass holds state or something)<br>
>><br>
>> 2. Rename the old pass class.<br>
>><br>
>> llvm/lib/Transforms/IPO/FunctionAttrs.cpp<br>
>> Rename class ReversePostOrderFunctionAttrs -><br>
>> ReversePostOrderFunctionAttrsLegacyPass<br>
>> in preparation for adding a class ReversePostOrderFunctionAttrs as the<br>
>> pass in the new PM.<br>
>> (edit: actually wait what? The new class name will be<br>
>> ReversePostOrderFunctionAttrsPass, so it doesn't conflict. So this step is<br>
>> sort of useless churn).<br>
>><br>
>> llvm/include/llvm/InitializePasses.h<br>
>> llvm/lib/LTO/LTOCodeGenerator.cpp<br>
>> llvm/lib/Transforms/IPO/IPO.cpp<br>
>> llvm/lib/Transforms/IPO/FunctionAttrs.cpp<br>
>> Rename initializeReversePostOrderFunctionAttrsPass -><br>
>> initializeReversePostOrderFunctionAttrsLegacyPassPass<br>
>> (note that the "PassPass" thing falls out of<br>
>> `s/ReversePostOrderFunctionAttrs/ReversePostOrderFunctionAttrsLegacyPass/`)<br>
>> Note that the INITIALIZE_PASS macro is what creates this identifier name,<br>
>> so renaming the class requires this renaming too.<br>
>><br>
>> Note that createReversePostOrderFunctionAttrsPass does not need to be<br>
>> renamed since its name is not generated from the class name.<br>
>><br>
>> 3. Add the new PM pass class.<br>
>><br>
>> In the new PM all passes need to have their<br>
>> declaration in a header somewhere, so you will often need to add a header.<br>
>> In this case<br>
>> llvm/include/llvm/Transforms/IPO/FunctionAttrs.h is already there because<br>
>> PostOrderFunctionAttrsPass was already ported.<br>
>> The file-level comment from the .cpp file can be used as the file-level<br>
>> comment for the new header. You may want to tweak the wording slightly<br>
>> from "this file implements" to "this file provides" or similar.<br>
>><br>
>> Add declaration for the new PM pass in this header:<br>
>><br>
>>     class ReversePostOrderFunctionAttrsPass<br>
>>         : public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {<br>
>>     public:<br>
>>       PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);<br>
>>     };<br>
>><br>
>> Its name should end with `Pass` for consistency (note that this doesn't<br>
>> collide with the names of most old PM passes). E.g. call it<br>
>> `<name of the old PM pass>Pass`.<br>
>><br>
>> Also, move the doxygen comment from the old PM pass to the declaration of<br>
>> this class in the header.<br>
>> Also, include the declaration for the new PM class<br>
>> `llvm/Transforms/IPO/FunctionAttrs.h` at the top of the file (in this<br>
>> case,<br>
>> it was already done when the other pass in this file was ported).<br>
>><br>
>> Now define the `run` method for the new class.<br>
>> The main things here are:<br>
>> a) Use AM.getResult<...>(M) to get results instead of `getAnalysis<...>()`<br>
>><br>
>> b) If the old PM pass would have returned "false" (i.e. `Changed ==<br>
>> false`), then you should return PreservedAnalyses::all();<br>
>><br>
>> c) In the old PM getAnalysisUsage method, observe the calls<br>
>>    `AU.addPreserved<...>();`.<br>
>><br>
>>    In the case `Changed == true`, for each preserved analysis you should<br>
>> do<br>
>>    call `PA.preserve<...>()` on a PreservedAnalyses object and return it.<br>
>>    E.g.:<br>
>><br>
>>        PreservedAnalyses PA;<br>
>>        PA.preserve<CallGraphAnalysis>();<br>
>>        return PA;<br>
>><br>
>> Note that calls to skipModule/skipFunction are not supported in the new PM<br>
>> currently, so optnone and optimization bisect support do not work. You can<br>
>> just drop those calls for now.<br>
>><br>
>> 4. Add the pass to the new PM pass registry to make it available in opt.<br>
>><br>
>> In llvm/lib/Passes/PassBuilder.cpp add a #include for your header.<br>
>> `#include "llvm/Transforms/IPO/FunctionAttrs.h"`<br>
>> In this case there is already an include (from when<br>
>> PostOrderFunctionAttrsPass was ported).<br>
>><br>
>> Add your pass to llvm/lib/Passes/PassRegistry.def<br>
>> In this case, I added<br>
>> `MODULE_PASS("rpo-functionattrs", ReversePostOrderFunctionAttrsPass())`<br>
>> The string is from the `INITIALIZE_PASS*` macros used in the old pass<br>
>> manager.<br>
>><br>
>> Then choose a test that uses the pass and use the new PM `-passes=...` to<br>
>> run it.<br>
>> E.g. in this case there is a test that does:<br>
>> ; RUN: opt < %s -basicaa -functionattrs -rpo-functionattrs -S | FileCheck<br>
>> %s<br>
>> I have added the line:<br>
>> ; RUN: opt < %s -aa-pipeline=basic-aa<br>
>> -passes='require<targetlibinfo>,cgscc(function-attrs),rpo-functionattrs' -S<br>
>> | FileCheck %s<br>
>> The `-aa-pipeline=basic-aa` and<br>
>> `require<targetlibinfo>,cgscc(function-attrs)` are what is needed to run<br>
>> functionattrs in the new PM (note that in the new PM "functionattrs"<br>
>> becomes "function-attrs" for some reason). This is just pulled from<br>
>> `readattrs.ll` which contains the change from when functionattrs was<br>
>> ported<br>
>> to the new PM.<br>
>> Adding rpo-functionattrs causes the pass that was just ported to run.<br>
>><br>
>> Modified:<br>
>>     llvm/trunk/include/llvm/InitializePasses.h<br>
>>     llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h<br>
>>     llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br>
>>     llvm/trunk/lib/Passes/PassRegistry.def<br>
>>     llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp<br>
>>     llvm/trunk/lib/Transforms/IPO/IPO.cpp<br>
>>     llvm/trunk/test/Transforms/FunctionAttrs/norecurse.ll<br>
>><br>
>> Modified: llvm/trunk/include/llvm/InitializePasses.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=272505&r1=272504&r2=272505&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=272505&r1=272504&r2=272505&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/InitializePasses.h (original)<br>
>> +++ llvm/trunk/include/llvm/InitializePasses.h Sun Jun 12 02:48:51 2016<br>
>> @@ -279,7 +279,7 @@ void initializeRegionPrinterPass(PassReg<br>
>>  void initializeRegionViewerPass(PassRegistry&);<br>
>>  void initializeRegisterCoalescerPass(PassRegistry&);<br>
>>  void initializeRenameIndependentSubregsPass(PassRegistry&);<br>
>> -void initializeReversePostOrderFunctionAttrsPass(PassRegistry&);<br>
>> +void<br>
>> initializeReversePostOrderFunctionAttrsLegacyPassPass(PassRegistry&);<br>
>>  void initializeRewriteStatepointsForGCPass(PassRegistry&);<br>
>>  void initializeRewriteSymbolsPass(PassRegistry&);<br>
>>  void initializeSCCPLegacyPassPass(PassRegistry &);<br>
>><br>
>> Modified: llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h?rev=272505&r1=272504&r2=272505&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h?rev=272505&r1=272504&r2=272505&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h (original)<br>
>> +++ llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h Sun Jun 12<br>
>> 02:48:51 2016<br>
>> @@ -37,6 +37,21 @@ struct PostOrderFunctionAttrsPass : Pass<br>
>>  /// in post-order.<br>
>>  Pass *createPostOrderFunctionAttrsLegacyPass();<br>
>><br>
>> +/// A pass to do RPO deduction and propagation of function attributes.<br>
>> +///<br>
>> +/// This pass provides a general RPO or "top down" propagation of<br>
>> +/// function attributes. For a few (rare) cases, we can deduce<br>
>> significantly<br>
>> +/// more about function attributes by working in RPO, so this pass<br>
>> +/// provides the compliment to the post-order pass above where the<br>
>> majority of<br>
>> +/// deduction is performed.<br>
>> +// FIXME: Currently there is no RPO CGSCC pass structure to slide into<br>
>> and so<br>
>> +// this is a boring module pass, but eventually it should be an RPO CGSCC<br>
>> pass<br>
>> +// when such infrastructure is available.<br>
>> +class ReversePostOrderFunctionAttrsPass<br>
>> +    : public PassInfoMixin<ReversePostOrderFunctionAttrsPass> {<br>
>> +public:<br>
>> +  PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);<br>
>> +};<br>
>>  }<br>
>><br>
>>  #endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H<br>
>><br>
>> Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=272505&r1=272504&r2=272505&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=272505&r1=272504&r2=272505&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)<br>
>> +++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Sun Jun 12 02:48:51 2016<br>
>> @@ -122,7 +122,7 @@ void LTOCodeGenerator::initializeLTOPass<br>
>>    initializeSROA_DTPass(R);<br>
>>    initializeSROA_SSAUpPass(R);<br>
>>    initializePostOrderFunctionAttrsLegacyPassPass(R);<br>
>> -  initializeReversePostOrderFunctionAttrsPass(R);<br>
>> +  initializeReversePostOrderFunctionAttrsLegacyPassPass(R);<br>
>>    initializeGlobalsAAWrapperPassPass(R);<br>
>>    initializeLICMPass(R);<br>
>>    initializeMergedLoadStoreMotionPass(R);<br>
>><br>
>> Modified: llvm/trunk/lib/Passes/PassRegistry.def<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=272505&r1=272504&r2=272505&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=272505&r1=272504&r2=272505&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Passes/PassRegistry.def (original)<br>
>> +++ llvm/trunk/lib/Passes/PassRegistry.def Sun Jun 12 02:48:51 2016<br>
>> @@ -56,6 +56,7 @@ MODULE_PASS("print-profile-summary", Pro<br>
>>  MODULE_PASS("print-callgraph", CallGraphPrinterPass(dbgs()))<br>
>>  MODULE_PASS("print", PrintModulePass(dbgs()))<br>
>>  MODULE_PASS("print-lcg", LazyCallGraphPrinterPass(dbgs()))<br>
>> +MODULE_PASS("rpo-functionattrs", ReversePostOrderFunctionAttrsPass())<br>
>>  MODULE_PASS("sample-profile", SampleProfileLoaderPass())<br>
>>  MODULE_PASS("strip-dead-prototypes", StripDeadPrototypesPass())<br>
>>  MODULE_PASS("verify", VerifierPass())<br>
>><br>
>> Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=272505&r1=272504&r2=272505&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=272505&r1=272504&r2=272505&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)<br>
>> +++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Sun Jun 12 02:48:51<br>
>> 2016<br>
>> @@ -1137,20 +1137,10 @@ bool PostOrderFunctionAttrsLegacyPass::r<br>
>>  }<br>
>><br>
>>  namespace {<br>
>> -/// A pass to do RPO deduction and propagation of function attributes.<br>
>> -///<br>
>> -/// This pass provides a general RPO or "top down" propagation of<br>
>> -/// function attributes. For a few (rare) cases, we can deduce<br>
>> significantly<br>
>> -/// more about function attributes by working in RPO, so this pass<br>
>> -/// provides the compliment to the post-order pass above where the<br>
>> majority of<br>
>> -/// deduction is performed.<br>
>> -// FIXME: Currently there is no RPO CGSCC pass structure to slide into<br>
>> and so<br>
>> -// this is a boring module pass, but eventually it should be an RPO CGSCC<br>
>> pass<br>
>> -// when such infrastructure is available.<br>
>> -struct ReversePostOrderFunctionAttrs : public ModulePass {<br>
>> +struct ReversePostOrderFunctionAttrsLegacyPass : public ModulePass {<br>
>>    static char ID; // Pass identification, replacement for typeid<br>
>> -  ReversePostOrderFunctionAttrs() : ModulePass(ID) {<br>
>> -<br>
>> initializeReversePostOrderFunctionAttrsPass(*PassRegistry::getPassRegistry());<br>
>> +  ReversePostOrderFunctionAttrsLegacyPass() : ModulePass(ID) {<br>
>> +<br>
>> initializeReversePostOrderFunctionAttrsLegacyPassPass(*PassRegistry::getPassRegistry());<br>
>>    }<br>
>><br>
>>    bool runOnModule(Module &M) override;<br>
>> @@ -1163,15 +1153,15 @@ struct ReversePostOrderFunctionAttrs : p<br>
>>  };<br>
>>  }<br>
>><br>
>> -char ReversePostOrderFunctionAttrs::ID = 0;<br>
>> -INITIALIZE_PASS_BEGIN(ReversePostOrderFunctionAttrs, "rpo-functionattrs",<br>
>> +char ReversePostOrderFunctionAttrsLegacyPass::ID = 0;<br>
>> +INITIALIZE_PASS_BEGIN(ReversePostOrderFunctionAttrsLegacyPass,<br>
>> "rpo-functionattrs",<br>
>>                        "Deduce function attributes in RPO", false, false)<br>
>>  INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)<br>
>> -INITIALIZE_PASS_END(ReversePostOrderFunctionAttrs, "rpo-functionattrs",<br>
>> +INITIALIZE_PASS_END(ReversePostOrderFunctionAttrsLegacyPass,<br>
>> "rpo-functionattrs",<br>
>>                      "Deduce function attributes in RPO", false, false)<br>
>><br>
>>  Pass *llvm::createReversePostOrderFunctionAttrsPass() {<br>
>> -  return new ReversePostOrderFunctionAttrs();<br>
>> +  return new ReversePostOrderFunctionAttrsLegacyPass();<br>
>>  }<br>
>><br>
>>  static bool addNoRecurseAttrsTopDown(Function &F) {<br>
>> @@ -1229,7 +1219,7 @@ static bool deduceFunctionAttributeInRPO<br>
>>    return Changed;<br>
>>  }<br>
>><br>
>> -bool ReversePostOrderFunctionAttrs::runOnModule(Module &M) {<br>
>> +bool ReversePostOrderFunctionAttrsLegacyPass::runOnModule(Module &M) {<br>
>>    if (skipModule(M))<br>
>>      return false;<br>
>><br>
>> @@ -1237,3 +1227,15 @@ bool ReversePostOrderFunctionAttrs::runO<br>
>><br>
>>    return deduceFunctionAttributeInRPO(M, CG);<br>
>>  }<br>
>> +<br>
>> +PreservedAnalyses<br>
>> +ReversePostOrderFunctionAttrsPass::run(Module &M, AnalysisManager<Module><br>
>> &AM) {<br>
>> +  auto &CG = AM.getResult<CallGraphAnalysis>(M);<br>
>> +<br>
>> +  bool Changed = deduceFunctionAttributeInRPO(M, CG);<br>
>> +  if (!Changed)<br>
>> +    return PreservedAnalyses::all();<br>
>> +  PreservedAnalyses PA;<br>
>> +  PA.preserve<CallGraphAnalysis>();<br>
>> +  return PA;<br>
>> +}<br>
>><br>
>> Modified: llvm/trunk/lib/Transforms/IPO/IPO.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPO.cpp?rev=272505&r1=272504&r2=272505&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPO.cpp?rev=272505&r1=272504&r2=272505&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/lib/Transforms/IPO/IPO.cpp (original)<br>
>> +++ llvm/trunk/lib/Transforms/IPO/IPO.cpp Sun Jun 12 02:48:51 2016<br>
>> @@ -43,7 +43,7 @@ void llvm::initializeIPO(PassRegistry &R<br>
>>    initializeMergeFunctionsPass(Registry);<br>
>>    initializePartialInlinerPass(Registry);<br>
>>    initializePostOrderFunctionAttrsLegacyPassPass(Registry);<br>
>> -  initializeReversePostOrderFunctionAttrsPass(Registry);<br>
>> +  initializeReversePostOrderFunctionAttrsLegacyPassPass(Registry);<br>
>>    initializePruneEHPass(Registry);<br>
>>    initializeStripDeadPrototypesLegacyPassPass(Registry);<br>
>>    initializeStripSymbolsPass(Registry);<br>
>><br>
>> Modified: llvm/trunk/test/Transforms/FunctionAttrs/norecurse.ll<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/FunctionAttrs/norecurse.ll?rev=272505&r1=272504&r2=272505&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/FunctionAttrs/norecurse.ll?rev=272505&r1=272504&r2=272505&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- llvm/trunk/test/Transforms/FunctionAttrs/norecurse.ll (original)<br>
>> +++ llvm/trunk/test/Transforms/FunctionAttrs/norecurse.ll Sun Jun 12<br>
>> 02:48:51 2016<br>
>> @@ -1,4 +1,5 @@<br>
>>  ; RUN: opt < %s -basicaa -functionattrs -rpo-functionattrs -S | FileCheck<br>
>> %s<br>
>> +; RUN: opt < %s -aa-pipeline=basic-aa<br>
>> -passes='require<targetlibinfo>,cgscc(function-attrs),rpo-functionattrs' -S<br>
>> | FileCheck %s<br>
>><br>
>>  ; CHECK: define i32 @leaf() #0<br>
>>  define i32 @leaf() {<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
><br>
><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>