[PATCH] D78225: [MustExecute] checkForAllContext(): use pre-increment
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 11:30:35 PDT 2020
lebedev.ri created this revision.
lebedev.ri added a reviewer: jdoerfert.
lebedev.ri added a project: LLVM.
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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78225
Files:
llvm/include/llvm/Analysis/MustExecute.h
Index: llvm/include/llvm/Analysis/MustExecute.h
===================================================================
--- llvm/include/llvm/Analysis/MustExecute.h
+++ llvm/include/llvm/Analysis/MustExecute.h
@@ -469,7 +469,7 @@
/// true if \p Pred holds in every instruction.
bool checkForAllContext(const Instruction *PP,
const function_ref<bool(const Instruction *)> &Pred) {
- for (auto EIt = begin(PP), EEnd = end(PP); EIt != EEnd; EIt++)
+ for (auto EIt = begin(PP), EEnd = end(PP); EIt != EEnd; ++EIt)
if (!Pred(*EIt))
return false;
return true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78225.257766.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/b8d0b127/attachment.bin>
More information about the llvm-commits
mailing list