[PATCH] D48578: use a MapVector for pass manage LastUser

Dave Airlie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 19:21:43 PDT 2018


airlied created this revision.
Herald added subscribers: llvm-commits, tpr, mehdi_amini.

with AMDGPU we end up having 208 passes to initialise, this
makes the loop over LastUser in PMTopLevelManager::setLastUser
appear quite high on the CPU usage. Since we have to initialise
the context and pass for every shader due to threading, we
see this quite often.

In a test of initing a bunch of shaders and exiting, this takes
the runtime down from 2.3s to 2.2s since the MapVector has
more efficient iterating.


Repository:
  rL LLVM

https://reviews.llvm.org/D48578

Files:
  include/llvm/IR/LegacyPassManagers.h


Index: include/llvm/IR/LegacyPassManagers.h
===================================================================
--- include/llvm/IR/LegacyPassManagers.h
+++ include/llvm/IR/LegacyPassManagers.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/MapVector.h"
 #include "llvm/Pass.h"
 #include <vector>
 
@@ -237,7 +238,7 @@
 
   // Map to keep track of last user of the analysis pass.
   // LastUser->second is the last user of Lastuser->first.
-  DenseMap<Pass *, Pass *> LastUser;
+  MapVector<Pass *, Pass *> LastUser;
 
   // Map to keep track of passes that are last used by a pass.
   // This inverse map is initialized at PM->run() based on


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48578.152820.patch
Type: text/x-patch
Size: 738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180626/d20b036b/attachment.bin>


More information about the llvm-commits mailing list