[llvm] 326da4a - [FuncAttrs] Always preserve FunctionAnalysisManagerCGSCCProxy

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 16:37:57 PDT 2021


Author: Arthur Eubanks
Date: 2021-04-20T16:37:45-07:00
New Revision: 326da4adcb8def2abdd530299d87ce951c0edec9

URL: https://github.com/llvm/llvm-project/commit/326da4adcb8def2abdd530299d87ce951c0edec9
DIFF: https://github.com/llvm/llvm-project/commit/326da4adcb8def2abdd530299d87ce951c0edec9.diff

LOG: [FuncAttrs] Always preserve FunctionAnalysisManagerCGSCCProxy

FunctionAnalysisManagerCGSCCProxy should not be preserved if any of its
keys may be invalid. Since we are not removing/adding functions in
FuncAttrs, it's fine to preserve it.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D100893

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/FunctionAttrs.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 64966bddfe0c4..8f80a61ae08ee 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1632,8 +1632,12 @@ PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C,
     Functions.push_back(&N.getFunction());
   }
 
-  if (deriveAttrsInPostOrder(Functions, AARGetter))
-    return PreservedAnalyses::none();
+  if (deriveAttrsInPostOrder(Functions, AARGetter)) {
+    // We have not changed the call graph or removed/added functions.
+    PreservedAnalyses PA;
+    PA.preserve<FunctionAnalysisManagerCGSCCProxy>();
+    return PA;
+  }
 
   return PreservedAnalyses::all();
 }


        


More information about the llvm-commits mailing list