[PATCH] D100893: [FuncAttrs] Always preserve FunctionAnalysisManagerCGSCCProxy

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 15:08:48 PDT 2021


aeubanks created this revision.
aeubanks added reviewers: asbirlea, mtrofin.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100893

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


Index: llvm/lib/Transforms/IPO/FunctionAttrs.cpp
===================================================================
--- llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1632,8 +1632,12 @@
     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();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100893.339006.patch
Type: text/x-patch
Size: 645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210420/527e4584/attachment.bin>


More information about the llvm-commits mailing list