[PATCH] D80707: [legacyPM] Do not compute preserved analysis if there's no local change

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 28 04:18:30 PDT 2020


serge-sans-paille created this revision.
serge-sans-paille added reviewers: chandlerc, sunfish, lattner.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

It is my understanding that all analysis are preserved if there's no local change.
Skipping the dependency computation in that cas dramatically improves
performance when there's a lot of small functions, where only a few change happen.

Related to this thread https://lists.llvm.org/pipermail/llvm-dev/2020-May/141482.html
After applying the patch, the execution time of llc on my laptop on the provided test case on master branch drops from 10 to 7 seconds.


https://reviews.llvm.org/D80707

Files:
  llvm/lib/IR/LegacyPassManager.cpp


Index: llvm/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/lib/IR/LegacyPassManager.cpp
+++ llvm/lib/IR/LegacyPassManager.cpp
@@ -1503,7 +1503,8 @@
     dumpUsedSet(FP);
 
     verifyPreservedAnalysis(FP);
-    removeNotPreservedAnalysis(FP);
+    if (LocalChanged)
+      removeNotPreservedAnalysis(FP);
     recordAvailableAnalysis(FP);
     removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
   }
@@ -1602,7 +1603,8 @@
     dumpUsedSet(MP);
 
     verifyPreservedAnalysis(MP);
-    removeNotPreservedAnalysis(MP);
+    if (LocalChanged)
+      removeNotPreservedAnalysis(MP);
     recordAvailableAnalysis(MP);
     removeDeadPasses(MP, M.getModuleIdentifier(), ON_MODULE_MSG);
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80707.266803.patch
Type: text/x-patch
Size: 745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200528/29555d72/attachment.bin>


More information about the llvm-commits mailing list