[llvm] 3218c06 - [legacyPM] Do not compute preserved analysis if there's no local change

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 28 02:02:44 PDT 2020


Author: serge-sans-paille
Date: 2020-07-28T11:01:04+02:00
New Revision: 3218c064d6d8c2cc910570c9a13cb859a2e91d08

URL: https://github.com/llvm/llvm-project/commit/3218c064d6d8c2cc910570c9a13cb859a2e91d08
DIFF: https://github.com/llvm/llvm-project/commit/3218c064d6d8c2cc910570c9a13cb859a2e91d08.diff

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

All analysis are preserved if there's no local change, and thanks to
3667d87a33d3c8d4072a41fd84bb880c59347dc0 this property is enforced for all
passes.

Skipping the dependency computation improves the performance when there's a lot
of small functions, where only a few change happen.

Thanks to Nikita Popov who provided this numbers (extract below)

https://llvm-compile-time-tracker.com/compare.php?from=183342c0a9850e60dd7a004b651c83dfb3a7d25e&to=f2f91e6a2743070471cc9471e4e8c646e50c653c&stat=instructions

O3: (number of instructions)
Benchmark               Old             New
kimwitu++               60783M          59968M          (-1.34%)
sqlite3                 73200M          73083M          (-0.16%)
consumer-typeset        52776M          52712M          (-0.12%)
Bullet                  133709M         132940M         (-0.58%)
tramp3d-v4              123864M         123186M         (-0.55%)
mafft                   55534M          55477M          (-0.10%)
ClamAV                  76292M          76164M          (-0.17%)
lencod                  103190M         103061M         (-0.13%)
SPASS                   64068M          63713M          (-0.55%)
7zip                    197332M         196308M         (-0.52%)
geomean                 85750M          85389M          (-0.42%)

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

Added: 
    

Modified: 
    llvm/lib/IR/LegacyPassManager.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index 74869fa62c66..c01696e4e575 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -1614,7 +1614,8 @@ bool FPPassManager::runOnFunction(Function &F) {
     dumpUsedSet(FP);
 
     verifyPreservedAnalysis(FP);
-    removeNotPreservedAnalysis(FP);
+    if (LocalChanged)
+      removeNotPreservedAnalysis(FP);
     recordAvailableAnalysis(FP);
     removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
   }
@@ -1723,7 +1724,8 @@ MPPassManager::runOnModule(Module &M) {
     dumpUsedSet(MP);
 
     verifyPreservedAnalysis(MP);
-    removeNotPreservedAnalysis(MP);
+    if (LocalChanged)
+      removeNotPreservedAnalysis(MP);
     recordAvailableAnalysis(MP);
     removeDeadPasses(MP, M.getModuleIdentifier(), ON_MODULE_MSG);
   }


        


More information about the llvm-commits mailing list