[PATCH] D67561: [SampleFDO] minimize performance impact when profile-sample-accurate is enabled
Wei Mi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 16 16:04:46 PDT 2019
wmi marked an inline comment as done.
wmi added inline comments.
================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:1791
+ StringRef CanonName = FunctionSamples::getCanonicalFnName(F);
+ for (unsigned i = 0; i < NamesInProfile->size(); i++) {
+ if ((*NamesInProfile)[i] == CanonName) {
----------------
wmi wrote:
> davidxl wrote:
> > This is a linear search. What is the compile time impact?
> I will evaluate it and get back.
I did the evaluation. I didn't see any compile time increase when compiling an internal server benchmark, but I saw 1~2% compile time increase when bootstrapping clang. I am not very sure about the increase. Although I run comparison twice and saw the increase in both times, the time to bootstrap clang on my desktop is not very stable so it could be noise.
Anyway, I think it is better to avoid the linear scan for every function, so I change NameTable to be a StringSet.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67561/new/
https://reviews.llvm.org/D67561
More information about the llvm-commits
mailing list