In computeInlinedContextSizeForRange, the offset of range is only used one time, there is no need to cache the frame location stack.
Measured on one internal service binary, this can save 2GB memory usage and reduce a small run time (avoid one hash search).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
Nice catch!
llvm/tools/llvm-profgen/ProfiledBinary.h | ||
---|---|---|
496–502 | How about extend this function with a parameter for caching or not? |
llvm/tools/llvm-profgen/ProfiledBinary.h | ||
---|---|---|
496–502 | It seems the return types of the two functions should be different, the one without caching should return the value type instead of the reference as we don't store it to a map. |
llvm/tools/llvm-profgen/ProfiledBinary.h | ||
---|---|---|
496–502 | I see. Then it makes sense to leave them separate. How about flip the names, i.e getFrameLocationStackWithoutCaching -> getFrameLocationStack getFrameLocationStack -> getCachedFrameLocation Caching is expansive so we want users to be explicitly aware of it. Also perhaps in the future we want to use two containers for cached contexts, one for UseProbeDiscriminator==true and one for UseProbeDiscriminator==false. |
llvm/tools/llvm-profgen/ProfiledBinary.h | ||
---|---|---|
496–502 | Renamed, thanks for the suggestion! |
llvm/tools/llvm-profgen/ProfiledBinary.h | ||
---|---|---|
502 | nit: getCachedFrameLocation -> getCachedFrameLocationStack Sorry for missing it previously. |
Updating D128859: [llvm-profgen] Do not cache the frame location stack during computing inlined context size
How about extend this function with a parameter for caching or not?