[all-commits] [llvm/llvm-project] f54dc1: [MustExecute] checkForAllContext(): use pre-increment

Roman Lebedev via All-commits all-commits at lists.llvm.org
Wed Apr 15 14:13:54 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f54dc12e46fa896bbdc58d925aaf1ba51bc63992
      https://github.com/llvm/llvm-project/commit/f54dc12e46fa896bbdc58d925aaf1ba51bc63992
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-04-16 (Thu, 16 Apr 2020)

  Changed paths:
    M llvm/include/llvm/Analysis/MustExecute.h

  Log Message:
  -----------
  [MustExecute] checkForAllContext(): use pre-increment

Summary:
You'd think there is no difference, but this halves (yikes!) compiler memory usage
on `test-suite/MultiSource/Applications/SPASS/top.c` test,
because `MustBeExecutedIterator operator++()` is, well, post-increment,
it must create a duplicate of existing `MustBeExecutedIterator`,
which involves duplicating `VisitedSetTy Visited` which is `DenseSet`..

Old
```
   0.3573 ( 42.9%)   0.0264 ( 33.7%)   0.3837 ( 42.1%)   0.3837 ( 42.1%)  Deduce and propagate attributes (CGSCC pass)
   0.1011 ( 12.1%)   0.0199 ( 25.4%)   0.1210 ( 13.3%)   0.1210 ( 13.3%)  Deduce and propagate attributes
```
```
total runtime: 20.04s.
bytes allocated in total (ignoring deallocations): 1.09GB (54.63MB/s)
calls to allocation functions: 1142410 (57020/s)
temporary memory allocations: 500538 (24983/s)
peak heap memory consumption: 26.68MB
peak RSS (including heaptrack overhead): 944.85MB
total memory leaked: 8.85MB
```
New:
```
   0.3309 ( 39.8%)   0.0164 ( 33.3%)   0.3473 ( 39.5%)   0.3473 ( 39.5%)  Deduce and propagate attributes (CGSCC pass)
   0.1152 ( 13.9%)   0.0076 ( 15.5%)   0.1229 ( 14.0%)   0.1229 ( 14.0%)  Deduce and propagate attributes
```
```
total runtime: 19.49s.
bytes allocated in total (ignoring deallocations): 575.07MB (29.51MB/s)
calls to allocation functions: 909059 (46651/s)
temporary memory allocations: 276923 (14211/s)
peak heap memory consumption: 26.68MB
peak RSS (including heaptrack overhead): 942.90MB
total memory leaked: 8.85MB
```
Diff:
```
total runtime: -0.55s.
bytes allocated in total (ignoring deallocations): -519.41MB (946.11MB/s)
calls to allocation functions: -233351 (425047/s)
temporary memory allocations: -223615 (407313/s)
peak heap memory consumption: 0B
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: llvm-commits

Tags: #llvm

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


  Commit: 639b8da8dc4cb735e8fd001b7e674073365ff230
      https://github.com/llvm/llvm-project/commit/639b8da8dc4cb735e8fd001b7e674073365ff230
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-04-16 (Thu, 16 Apr 2020)

  Changed paths:
    M llvm/include/llvm/Transforms/IPO/Attributor.h

  Log Message:
  -----------
  [Attributor] KindToAbstractAttributeMap: use SmallDenseMap

Summary:
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
```

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: uenoku, llvm-commits

Tags: #llvm

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


Compare: https://github.com/llvm/llvm-project/compare/89680f25e854...639b8da8dc4c


More information about the All-commits mailing list