[PATCH] D78231: [Attributor] KindToAbstractAttributeMap: use SmallDenseMap

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 12:36:49 PDT 2020


lebedev.ri created this revision.
lebedev.ri added a reviewer: jdoerfert.
lebedev.ri added a project: LLVM.
Herald added a reviewer: sstefan1.
Herald added a reviewer: uenoku.
Herald added a subscriber: uenoku.
lebedev.ri added a parent revision: D78225: [MustExecute] checkForAllContext(): use pre-increment.

While this is less efficient to allocate huge `SmallDenseMap` for each `IRPosition` in `AAMap`,
in the larger picture this is much better, since we'd eventually either fill each `IRPosition`,
with each possible attribute, or at least quert for it, which would allocate it anyway.
So we are better off pre-allocating.

Old:

  0.3460 ( 40.7%)   0.0183 ( 33.9%)   0.3643 ( 40.3%)   0.3644 ( 40.3%)  Deduce and propagate attributes (CGSCC pass)
  0.1135 ( 13.4%)   0.0080 ( 14.7%)   0.1215 ( 13.4%)   0.1215 ( 13.4%)  Deduce and propagate attributes

  total runtime: 19.48s.
  bytes allocated in total (ignoring deallocations): 575.02MB (29.51MB/s)
  calls to allocation functions: 908876 (46644/s)
  temporary memory allocations: 276654 (14198/s)
  peak heap memory consumption: 26.68MB
  peak RSS (including heaptrack overhead): 944.78MB
  total memory leaked: 8.85MB

New:

  0.3223 ( 38.1%)   0.0299 ( 53.6%)   0.3522 ( 39.1%)   0.3522 ( 39.1%)  Deduce and propagate attributes (CGSCC pass)
  0.1150 ( 13.6%)   0.0037 (  6.7%)   0.1188 ( 13.2%)   0.1188 ( 13.2%)  Deduce and propagate attributes

  total runtime: 19.06s.
  bytes allocated in total (ignoring deallocations): 363.21MB (19.06MB/s)
  calls to allocation functions: 679660 (35658/s)
  temporary memory allocations: 83472 (4379/s)
  peak heap memory consumption: 27.00MB
  peak RSS (including heaptrack overhead): 931.66MB
  total memory leaked: 8.85MB

Diff:

  total runtime: -0.42s.
  bytes allocated in total (ignoring deallocations): -211.81MB (498.38MB/s)
  calls to allocation functions: -229216 (539331/s)
  temporary memory allocations: -193182 (454545/s)
  peak heap memory consumption: 321.54KB
  peak RSS (including heaptrack overhead): 0B
  total memory leaked: 0B


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D78231

Files:
  llvm/include/llvm/Transforms/IPO/Attributor.h


Index: llvm/include/llvm/Transforms/IPO/Attributor.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/Attributor.h
+++ llvm/include/llvm/Transforms/IPO/Attributor.h
@@ -1207,7 +1207,7 @@
   /// the inner level.
   ///{
   using KindToAbstractAttributeMap =
-      DenseMap<const char *, AbstractAttribute *>;
+      SmallDenseMap<const char *, AbstractAttribute *, /*InlineBuckets=*/32>;
   DenseMap<IRPosition, KindToAbstractAttributeMap> AAMap;
   ///}
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78231.257796.patch
Type: text/x-patch
Size: 513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/fba06b0d/attachment.bin>


More information about the llvm-commits mailing list