<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 18, 2016 at 3:03 AM, Chandler Carruth 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">Author: chandlerc<br>
Date: Thu Feb 18 05:03:11 2016<br>
New Revision: 261203<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=261203&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=261203&view=rev</a><br>
Log:<br>
[PM] Port the PostOrderFunctionAttrs pass to the new pass manager and<br>
convert one test to use this.<br>
<br>
This is a particularly significant milestone because it required<br>
a working per-function AA framework which can be queried over each<br>
function from within a CGSCC transform pass (and additionally a module<br>
analysis to be accessible). This is essentially *the* point of the<br>
entire pass manager rewrite. A CGSCC transform is able to query for<br>
multiple different function's analysis results. It works. The whole<br>
thing appears to actually work and accomplish the original goal. While<br>
we were able to hack function attrs and basic-aa to "work" in the old<br>
pass manager, this port doesn't use any of that, it directly leverages<br>
the new fundamental functionality.<br></blockquote><div><br></div><div>Congrats!</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
For this to work, the CGSCC framework also has to support SCC-based<br>
behavior analysis, etc. The only part of the CGSCC pass infrastructure<br>
not sorted out at this point are the updates in the face of inlining and<br>
running function passes that mutate the call graph.<br>
<br>
The changes are pretty boring and boiler-plate. Most of the work was<br>
factored into more focused preperatory patches. But this is what wires<br>
it all together.<br>
<br>
Added:<br>
    llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h<br>
Modified:<br>
    llvm/trunk/include/llvm/InitializePasses.h<br>
    llvm/trunk/include/llvm/LinkAllPasses.h<br>
    llvm/trunk/include/llvm/Transforms/IPO.h<br>
    llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br>
    llvm/trunk/lib/Passes/PassBuilder.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/lib/Transforms/IPO/PassManagerBuilder.cpp<br>
    llvm/trunk/test/Transforms/FunctionAttrs/readattrs.ll<br>
<br>
Modified: llvm/trunk/include/llvm/InitializePasses.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/InitializePasses.h (original)<br>
+++ llvm/trunk/include/llvm/InitializePasses.h Thu Feb 18 05:03:11 2016<br>
@@ -231,7 +231,7 @@ void initializePostDomOnlyViewerPass(Pas<br>
 void initializePostDomPrinterPass(PassRegistry&);<br>
 void initializePostDomViewerPass(PassRegistry&);<br>
 void initializePostDominatorTreePass(PassRegistry&);<br>
-void initializePostOrderFunctionAttrsPass(PassRegistry&);<br>
+void initializePostOrderFunctionAttrsLegacyPassPass(PassRegistry&);<br>
 void initializePostRASchedulerPass(PassRegistry&);<br>
 void initializePostMachineSchedulerPass(PassRegistry&);<br>
 void initializePrintFunctionPassWrapperPass(PassRegistry&);<br>
<br>
Modified: llvm/trunk/include/llvm/LinkAllPasses.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/LinkAllPasses.h (original)<br>
+++ llvm/trunk/include/llvm/LinkAllPasses.h Thu Feb 18 05:03:11 2016<br>
@@ -36,6 +36,7 @@<br>
 #include "llvm/IR/Function.h"<br>
 #include "llvm/IR/IRPrintingPasses.h"<br>
 #include "llvm/Transforms/IPO.h"<br>
+#include "llvm/Transforms/IPO/FunctionAttrs.h"<br>
 #include "llvm/Transforms/Instrumentation.h"<br>
 #include "llvm/Transforms/ObjCARC.h"<br>
 #include "llvm/Transforms/Scalar.h"<br>
@@ -159,7 +160,7 @@ namespace {<br>
       (void) llvm::createPostDomTree();<br>
       (void) llvm::createInstructionNamerPass();<br>
       (void) llvm::createMetaRenamerPass();<br>
-      (void) llvm::createPostOrderFunctionAttrsPass();<br>
+      (void) llvm::createPostOrderFunctionAttrsLegacyPass();<br>
       (void) llvm::createReversePostOrderFunctionAttrsPass();<br>
       (void) llvm::createMergeFunctionsPass();<br>
       std::string buf;<br>
<br>
Modified: llvm/trunk/include/llvm/Transforms/IPO.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO.h?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Transforms/IPO.h (original)<br>
+++ llvm/trunk/include/llvm/Transforms/IPO.h Thu Feb 18 05:03:11 2016<br>
@@ -188,15 +188,6 @@ ModulePass *createBlockExtractorPass();<br>
 ModulePass *createStripDeadPrototypesPass();<br>
<br>
 //===----------------------------------------------------------------------===//<br>
-/// createPostOrderFunctionAttrsPass - This pass walks SCCs of the call graph<br>
-/// in post-order to deduce and propagate function attributes. It can discover<br>
-/// functions that do not access memory, or only read memory, and give them the<br>
-/// readnone/readonly attribute. It also discovers function arguments that are<br>
-/// not captured by the function and marks them with the nocapture attribute.<br>
-///<br>
-Pass *createPostOrderFunctionAttrsPass();<br>
-<br>
-//===----------------------------------------------------------------------===//<br>
 /// createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call<br>
 /// graph in RPO to deduce and propagate function attributes. Currently it<br>
 /// only handles synthesizing norecurse attributes.<br>
<br>
Added: llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h?rev=261203&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h?rev=261203&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h (added)<br>
+++ llvm/trunk/include/llvm/Transforms/IPO/FunctionAttrs.h Thu Feb 18 05:03:11 2016<br>
@@ -0,0 +1,45 @@<br>
+//===-- FunctionAttrs.h - Compute function attrs --------------------------===//<br>
+//<br>
+//                     The LLVM Compiler Infrastructure<br>
+//<br>
+// This file is distributed under the University of Illinois Open Source<br>
+// License. See LICENSE.TXT for details.<br>
+//<br>
+//===----------------------------------------------------------------------===//<br>
+/// \file<br>
+/// Provides passes for computing function attributes based on interprocedural<br>
+/// analyses.<br>
+//===----------------------------------------------------------------------===//<br>
+<br>
+#ifndef LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H<br>
+#define LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H<br>
+<br>
+#include "llvm/Analysis/LazyCallGraph.h"<br>
+#include "llvm/Analysis/CGSCCPassManager.h"<br>
+#include "llvm/IR/PassManager.h"<br>
+<br>
+namespace llvm {<br>
+<br>
+/// Computes function attributes in post-order over the call graph.<br>
+///<br>
+/// By operating in post-order, this pass computes precise attributes for<br>
+/// called functions prior to processsing their callers. This "bottom-up"<br>
+/// approach allows powerful interprocedural inference of function attributes<br>
+/// like memory access patterns, etc. It can discover functions that do not<br>
+/// access memory, or only read memory, and give them the readnone/readonly<br>
+/// attribute. It also discovers function arguments that are not captured by<br>
+/// the function and marks them with the nocapture attribute.<br>
+class PostOrderFunctionAttrsPass {<br>
+public:<br>
+  static StringRef name() { return "PostOrderFunctionAttrsPass"; }<br>
+<br>
+  PreservedAnalyses run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM);<br>
+};<br>
+<br>
+/// Create a legacy pass manager instance of a pass to compute function attrs<br>
+/// in post-order.<br>
+Pass *createPostOrderFunctionAttrsLegacyPass();<br>
+<br>
+}<br>
+<br>
+#endif // LLVM_TRANSFORMS_IPO_FUNCTIONATTRS_H<br>
<br>
Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)<br>
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Thu Feb 18 05:03:11 2016<br>
@@ -93,7 +93,7 @@ void LTOCodeGenerator::initializeLTOPass<br>
   initializeSROALegacyPassPass(R);<br>
   initializeSROA_DTPass(R);<br>
   initializeSROA_SSAUpPass(R);<br>
-  initializePostOrderFunctionAttrsPass(R);<br>
+  initializePostOrderFunctionAttrsLegacyPassPass(R);<br>
   initializeReversePostOrderFunctionAttrsPass(R);<br>
   initializeGlobalsAAWrapperPassPass(R);<br>
   initializeLICMPass(R);<br>
<br>
Modified: llvm/trunk/lib/Passes/PassBuilder.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassBuilder.cpp?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Passes/PassBuilder.cpp (original)<br>
+++ llvm/trunk/lib/Passes/PassBuilder.cpp Thu Feb 18 05:03:11 2016<br>
@@ -32,6 +32,7 @@<br>
 #include "llvm/Support/Debug.h"<br>
 #include "llvm/Target/TargetMachine.h"<br>
 #include "llvm/Transforms/IPO/ForceFunctionAttrs.h"<br>
+#include "llvm/Transforms/IPO/FunctionAttrs.h"<br>
 #include "llvm/Transforms/IPO/InferFunctionAttrs.h"<br>
 #include "llvm/Transforms/IPO/StripDeadPrototypes.h"<br>
 #include "llvm/Transforms/InstCombine/InstCombine.h"<br>
<br>
Modified: llvm/trunk/lib/Passes/PassRegistry.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Passes/PassRegistry.def?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Passes/PassRegistry.def (original)<br>
+++ llvm/trunk/lib/Passes/PassRegistry.def Thu Feb 18 05:03:11 2016<br>
@@ -47,6 +47,7 @@ CGSCC_ANALYSIS("no-op-cgscc", NoOpCGSCCA<br>
 #define CGSCC_PASS(NAME, CREATE_PASS)<br>
 #endif<br>
 CGSCC_PASS("invalidate<all>", InvalidateAllAnalysesPass())<br>
+CGSCC_PASS("function-attrs", PostOrderFunctionAttrsPass())<br>
 CGSCC_PASS("no-op-cgscc", NoOpCGSCCPass())<br>
 #undef CGSCC_PASS<br>
<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Thu Feb 18 05:03:11 2016<br>
@@ -13,6 +13,7 @@<br>
 ///<br>
 //===----------------------------------------------------------------------===//<br>
<br>
+#include "llvm/Transforms/IPO/FunctionAttrs.h"<br>
 #include "llvm/Transforms/IPO.h"<br>
 #include "llvm/ADT/SCCIterator.h"<br>
 #include "llvm/ADT/SetVector.h"<br>
@@ -52,39 +53,6 @@ typedef SmallSetVector<Function *, 8> SC<br>
 }<br>
<br>
 namespace {<br>
-struct PostOrderFunctionAttrs : public CallGraphSCCPass {<br>
-  static char ID; // Pass identification, replacement for typeid<br>
-  PostOrderFunctionAttrs() : CallGraphSCCPass(ID) {<br>
-    initializePostOrderFunctionAttrsPass(*PassRegistry::getPassRegistry());<br>
-  }<br>
-<br>
-  bool runOnSCC(CallGraphSCC &SCC) override;<br>
-<br>
-  void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
-    AU.setPreservesCFG();<br>
-    AU.addRequired<AssumptionCacheTracker>();<br>
-    AU.addRequired<TargetLibraryInfoWrapperPass>();<br>
-    addUsedAAAnalyses(AU);<br>
-    CallGraphSCCPass::getAnalysisUsage(AU);<br>
-  }<br>
-<br>
-private:<br>
-  TargetLibraryInfo *TLI;<br>
-};<br>
-}<br>
-<br>
-char PostOrderFunctionAttrs::ID = 0;<br>
-INITIALIZE_PASS_BEGIN(PostOrderFunctionAttrs, "functionattrs",<br>
-                      "Deduce function attributes", false, false)<br>
-INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)<br>
-INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)<br>
-INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)<br>
-INITIALIZE_PASS_END(PostOrderFunctionAttrs, "functionattrs",<br>
-                    "Deduce function attributes", false, false)<br>
-<br>
-Pass *llvm::createPostOrderFunctionAttrsPass() { return new PostOrderFunctionAttrs(); }<br>
-<br>
-namespace {<br>
 /// The three kinds of memory access relevant to 'readonly' and<br>
 /// 'readnone' attributes.<br>
 enum MemoryAccessKind {<br>
@@ -1019,7 +987,102 @@ static bool addNoRecurseAttrs(const SCCN<br>
   return setDoesNotRecurse(*F);<br>
 }<br>
<br>
-bool PostOrderFunctionAttrs::runOnSCC(CallGraphSCC &SCC) {<br>
+PreservedAnalyses<br>
+PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C, CGSCCAnalysisManager *AM) {<br>
+  Module &M = *C.begin()->getFunction().getParent();<br>
+  const ModuleAnalysisManager &MAM =<br>
+      AM->getResult<ModuleAnalysisManagerCGSCCProxy>(C).getManager();<br>
+  FunctionAnalysisManager &FAM =<br>
+      AM->getResult<FunctionAnalysisManagerCGSCCProxy>(C).getManager();<br>
+<br>
+  // FIXME: Need some way to make it more reasonable to assume that this is<br>
+  // always cached.<br>
+  TargetLibraryInfo &TLI = *MAM.getCachedResult<TargetLibraryAnalysis>(M);<br>
+<br>
+  // We pass a lambda into functions to wire them up to the analysis manager<br>
+  // for getting function analyses.<br>
+  auto AARGetter = [&](Function &F) -> AAResults & {<br>
+    return FAM.getResult<AAManager>(F);<br>
+  };<br>
+<br>
+  // Fill SCCNodes with the elements of the SCC. Also track whether there are<br>
+  // any external or opt-none nodes that will prevent us from optimizing any<br>
+  // part of the SCC.<br>
+  SCCNodeSet SCCNodes;<br>
+  bool HasUnknownCall = false;<br>
+  for (LazyCallGraph::Node &N : C) {<br>
+    Function &F = N.getFunction();<br>
+    if (F.hasFnAttribute(Attribute::OptimizeNone)) {<br>
+      // Treat any function we're trying not to optimize as if it were an<br>
+      // indirect call and omit it from the node set used below.<br>
+      HasUnknownCall = true;<br>
+      continue;<br>
+    }<br>
+    // Track whether any functions in this SCC have an unknown call edge.<br>
+    // Note: if this is ever a performance hit, we can common it with<br>
+    // subsequent routines which also do scans over the instructions of the<br>
+    // function.<br>
+    if (!HasUnknownCall)<br>
+      for (Instruction &I : instructions(F))<br>
+        if (auto CS = CallSite(&I))<br>
+          if (!CS.getCalledFunction()) {<br>
+            HasUnknownCall = true;<br>
+            break;<br>
+          }<br>
+<br>
+    SCCNodes.insert(&F);<br>
+  }<br>
+<br>
+  bool Changed = false;<br>
+  Changed |= addReadAttrs(SCCNodes, AARGetter);<br>
+  Changed |= addArgumentAttrs(SCCNodes);<br>
+<br>
+  // If we have no external nodes participating in the SCC, we can deduce some<br>
+  // more precise attributes as well.<br>
+  if (!HasUnknownCall) {<br>
+    Changed |= addNoAliasAttrs(SCCNodes);<br>
+    Changed |= addNonNullAttrs(SCCNodes, TLI);<br>
+    Changed |= removeConvergentAttrs(SCCNodes);<br>
+    Changed |= addNoRecurseAttrs(SCCNodes);<br>
+  }<br>
+<br>
+  return Changed ? PreservedAnalyses::none() : PreservedAnalyses::all();<br>
+}<br>
+<br>
+namespace {<br>
+struct PostOrderFunctionAttrsLegacyPass : public CallGraphSCCPass {<br>
+  static char ID; // Pass identification, replacement for typeid<br>
+  PostOrderFunctionAttrsLegacyPass() : CallGraphSCCPass(ID) {<br>
+    initializePostOrderFunctionAttrsLegacyPassPass(*PassRegistry::getPassRegistry());<br>
+  }<br>
+<br>
+  bool runOnSCC(CallGraphSCC &SCC) override;<br>
+<br>
+  void getAnalysisUsage(AnalysisUsage &AU) const override {<br>
+    AU.setPreservesCFG();<br>
+    AU.addRequired<AssumptionCacheTracker>();<br>
+    AU.addRequired<TargetLibraryInfoWrapperPass>();<br>
+    addUsedAAAnalyses(AU);<br>
+    CallGraphSCCPass::getAnalysisUsage(AU);<br>
+  }<br>
+<br>
+private:<br>
+  TargetLibraryInfo *TLI;<br>
+};<br>
+}<br>
+<br>
+char PostOrderFunctionAttrsLegacyPass::ID = 0;<br>
+INITIALIZE_PASS_BEGIN(PostOrderFunctionAttrsLegacyPass, "functionattrs",<br>
+                      "Deduce function attributes", false, false)<br>
+INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)<br>
+INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)<br>
+INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)<br>
+INITIALIZE_PASS_END(PostOrderFunctionAttrsLegacyPass, "functionattrs",<br>
+                    "Deduce function attributes", false, false)<br>
+<br>
+Pass *llvm::createPostOrderFunctionAttrsLegacyPass() { return new PostOrderFunctionAttrsLegacyPass(); }<br>
+<br>
+bool PostOrderFunctionAttrsLegacyPass::runOnSCC(CallGraphSCC &SCC) {<br>
   TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();<br>
   bool Changed = false;<br>
<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/IPO.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPO.cpp?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/IPO.cpp?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/IPO/IPO.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/IPO.cpp Thu Feb 18 05:03:11 2016<br>
@@ -18,6 +18,7 @@<br>
 #include "llvm/InitializePasses.h"<br>
 #include "llvm/IR/LegacyPassManager.h"<br>
 #include "llvm/Transforms/IPO.h"<br>
+#include "llvm/Transforms/IPO/FunctionAttrs.h"<br>
<br>
 using namespace llvm;<br>
<br>
@@ -41,7 +42,7 @@ void llvm::initializeIPO(PassRegistry &R<br>
   initializeLowerBitSetsPass(Registry);<br>
   initializeMergeFunctionsPass(Registry);<br>
   initializePartialInlinerPass(Registry);<br>
-  initializePostOrderFunctionAttrsPass(Registry);<br>
+  initializePostOrderFunctionAttrsLegacyPassPass(Registry);<br>
   initializeReversePostOrderFunctionAttrsPass(Registry);<br>
   initializePruneEHPass(Registry);<br>
   initializeStripDeadPrototypesLegacyPassPass(Registry);<br>
@@ -73,7 +74,7 @@ void LLVMAddDeadArgEliminationPass(LLVMP<br>
 }<br>
<br>
 void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM) {<br>
-  unwrap(PM)->add(createPostOrderFunctionAttrsPass());<br>
+  unwrap(PM)->add(createPostOrderFunctionAttrsLegacyPass());<br>
 }<br>
<br>
 void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM) {<br>
<br>
Modified: llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/IPO/PassManagerBuilder.cpp Thu Feb 18 05:03:11 2016<br>
@@ -31,6 +31,7 @@<br>
 #include "llvm/Target/TargetMachine.h"<br>
 #include "llvm/Transforms/IPO.h"<br>
 #include "llvm/Transforms/IPO/ForceFunctionAttrs.h"<br>
+#include "llvm/Transforms/IPO/FunctionAttrs.h"<br>
 #include "llvm/Transforms/IPO/InferFunctionAttrs.h"<br>
 #include "llvm/Transforms/Scalar.h"<br>
 #include "llvm/Transforms/Vectorize.h"<br>
@@ -382,7 +383,7 @@ void PassManagerBuilder::populateModuleP<br>
     Inliner = nullptr;<br>
   }<br>
   if (!DisableUnitAtATime)<br>
-    MPM.add(createPostOrderFunctionAttrsPass());<br>
+    MPM.add(createPostOrderFunctionAttrsLegacyPass());<br>
   if (OptLevel > 2)<br>
     MPM.add(createArgumentPromotionPass()); // Scalarize uninlined fn args<br>
<br>
@@ -577,7 +578,7 @@ void PassManagerBuilder::addLTOOptimizat<br>
   PM.add(createIPSCCPPass());<br>
<br>
   // Now that we internalized some globals, see if we can hack on them!<br>
-  PM.add(createPostOrderFunctionAttrsPass());<br>
+  PM.add(createPostOrderFunctionAttrsLegacyPass());<br>
   PM.add(createReversePostOrderFunctionAttrsPass());<br>
   PM.add(createGlobalOptimizerPass());<br>
   // Promote any localized global vars.<br>
@@ -627,7 +628,7 @@ void PassManagerBuilder::addLTOOptimizat<br>
     PM.add(createScalarReplAggregatesPass());<br>
<br>
   // Run a few AA driven optimizations here and now, to cleanup the code.<br>
-  PM.add(createPostOrderFunctionAttrsPass()); // Add nocapture.<br>
+  PM.add(createPostOrderFunctionAttrsLegacyPass()); // Add nocapture.<br>
   PM.add(createGlobalsAAWrapperPass()); // IP alias analysis.<br>
<br>
   PM.add(createLICMPass());                 // Hoist loop invariants.<br>
<br>
Modified: llvm/trunk/test/Transforms/FunctionAttrs/readattrs.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/FunctionAttrs/readattrs.ll?rev=261203&r1=261202&r2=261203&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/FunctionAttrs/readattrs.ll?rev=261203&r1=261202&r2=261203&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/FunctionAttrs/readattrs.ll (original)<br>
+++ llvm/trunk/test/Transforms/FunctionAttrs/readattrs.ll Thu Feb 18 05:03:11 2016<br>
@@ -1,4 +1,5 @@<br>
 ; RUN: opt < %s -functionattrs -S | FileCheck %s<br>
+; RUN: opt < %s -aa-pipeline=basic-aa -passes='require<targetlibinfo>,cgscc(function-attrs)' -S | FileCheck %s<br>
 @x = global i32 0<br>
<br>
 declare void @test1_1(i8* %x1_1, i8* readonly %y1_1, ...)<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>
</blockquote></div><br></div></div>