steakhal added a comment. In D86295#2229712 <https://reviews.llvm.org/D86295#2229712>, @NoQ wrote:
> Heh, nice! Did you try to measure the actual impact of this change on memory > and/or performance? Eh, I don't really know how to bench this. Here is how I did it in nutshell: Added STATISTIC counters to MemRegion ctor, dtor, getAsOffset begining and the path of just returning the cached value. F12722457: add-memregion-statistics.patch <https://reviews.llvm.org/F12722457> I have analyzed a faily big (50k+ LOC) TU of the llvm repository (`X86ISelLowering.cpp`). I was using the following command: /home/myuser/git/llvm-project/build/bin/clang --analyze -Qunused-arguments -Xclang -analyzer-opt-analyze-headers -Xclang -analyzer-output=text -Xclang -analyzer-config -Xclang expand-macros=true -Xclang -analyzer-checker=core -Xclang -analyzer-config -Xclang aggressive-binary-operation-simplification=true -x c++ --target=x86_64-linux-gnu -std=gnu++14 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/myuser/git/llvm-project/build/lib/Target/X86 -I/home/myuser/git/llvm-project/llvm/lib/Target/X86 -I/home/myuser/git/llvm-project/build/include -I/home/myuser/git/llvm-project/llvm/include -fPIC -fvisibility-inlines-hidden -Wno-unused-parameter -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wno-noexcept-type -Wno-comment -fdiagnostics-color -fPIC -fno-exceptions -fno-rtti -std=c++14 -isystem /usr/include/c++/7 -isystem /usr/include/x86_64-linux-gnu/c++/7 -isystem /usr/include/c++/7/backward -isystem /usr/local/include -isystem /usr/include/x86_64-linux-gnu -isystem /usr/include -Xclang -analyzer-stats /home/myuser/git/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp The relevant part of the log is: 1051489 MemRegion - The # of MemRegion objects were alive at a time during analysis 48603499 MemRegion - The # of times the MemRegion::getAsOffset was called and the result was already cached 49258796 MemRegion - The # of times the MemRegion::getAsOffset was called 1051489 MemRegion - The # of MemRegion objects alive at the given moment 1051489 MemRegion - The # of MemRegion objects created during the analysis --- > I think it'd make perfect sense to keep the offset in a side map. We don't > compute it for all regions, and for most regions it doesn't need to be > computed *at all*. It seems that at least with this configuration the `MemRegion::getAsOffset` was called every single time. Please have a look at the patch file, and the results - I might messed something up :s Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86295/new/ https://reviews.llvm.org/D86295 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits