<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Let's see...<div class=""><br class=""></div><div class="">With the bitcode for X86FastISel.cpp as input (-O0), I see about a 3% drop in the wall time for opt:</div><div class=""><br class=""></div><div class="">pre-patch</div><br class="">$ ../<a href="http://llvm.org" class="">llvm.org</a>-combines-RA/bin/opt -instrprof test.bc -o /dev/null -time-passes<br class="">===-------------------------------------------------------------------------===<br class=""> ... Pass execution timing report ...<br class="">===-------------------------------------------------------------------------===<br class=""> Total Execution Time: 0.1236 seconds (0.1236 wall clock)<br class=""><br class=""> ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---<br class=""> 0.0763 ( 65.4%) 0.0055 ( 79.9%) 0.0818 ( 66.2%) 0.0818 ( 66.2%) Bitcode Writer<br class=""> 0.0369 ( 31.7%) 0.0014 ( 19.8%) 0.0383 ( 31.0%) 0.0384 ( 31.0%) Module Verifier<br class=""> 0.0035 ( 3.0%) 0.0000 ( 0.4%) 0.0035 ( 2.8%) 0.0035 ( 2.8%) Frontend instrumentation-based coverage lowering<br class=""> 0.1167 (100.0%) 0.0069 (100.0%) 0.1236 (100.0%) 0.1236 (100.0%) Total<br class=""><br class="">post-patch<br class=""><br class="">$ ./bin/opt -instrprof test.bc -o /dev/null -time-passes<br class="">===-------------------------------------------------------------------------===<br class=""> ... Pass execution timing report ...<br class="">===-------------------------------------------------------------------------===<br class=""> Total Execution Time: 0.1161 seconds (0.1161 wall clock)<br class=""><br class=""> ---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---<br class=""> 0.0761 ( 69.7%) 0.0057 ( 81.1%) 0.0818 ( 70.4%) 0.0818 ( 70.5%) Bitcode Writer<br class=""> 0.0330 ( 30.2%) 0.0013 ( 18.8%) 0.0343 ( 29.6%) 0.0343 ( 29.5%) Module Verifier<br class=""> 0.0000 ( 0.0%) 0.0000 ( 0.1%) 0.0000 ( 0.0%) 0.0000 ( 0.0%) Frontend instrumentation-based coverage lowering<br class=""> 0.1091 (100.0%) 0.0070 (100.0%) 0.1161 (100.0%) 0.1161 (100.0%) Total<br class=""><br class="">The real motivation is that we might consider always enabling -instrprof in Swift, because when you import a swiftmodule, it can contained arbitrary serialized SIL, including profiling intrinsics. For now we have a simpler solution: <a href="https://github.com/apple/swift/pull/14206" class="">https://github.com/apple/swift/pull/14206</a>. This is just a bit of future-proofing.<br class=""><br class="">vedant<br class=""><br class=""><blockquote type="cite" class="">On Jan 26, 2018, at 4:52 PM, Davide Italiano <<a href="mailto:davide@freebsd.org" class="">davide@freebsd.org</a>> wrote:<br class=""><br class="">This is good. Do you happen to have numbers for my own intellectual<br class="">curiosity? (and for the archives)<br class=""><br class="">On Fri, Jan 26, 2018 at 3:54 PM, Vedant Kumar via llvm-commits<br class=""><<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:<br class=""><blockquote type="cite" class="">Author: vedantk<br class="">Date: Fri Jan 26 15:54:24 2018<br class="">New Revision: 323574<br class=""><br class="">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=323574&view=rev" class="">http://llvm.org/viewvc/llvm-project?rev=323574&view=rev</a><br class="">Log:<br class="">[InstrProfiling] Improve compile time when there is no work<br class=""><br class="">When there are no uses of profiling intrinsics in a module, and there's<br class="">no coverage data to lower, InstrProfiling has no work to do.<br class=""><br class="">Modified:<br class=""> llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br class=""><br class="">Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br class="">URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=323574&r1=323573&r2=323574&view=diff" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=323574&r1=323573&r2=323574&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)<br class="">+++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Fri Jan 26 15:54:24 2018<br class="">@@ -430,7 +430,27 @@ void InstrProfiling::promoteCounterLoadS<br class=""> }<br class="">}<br class=""><br class="">+/// Check if the module contains uses of any profiling intrinsics.<br class="">+static bool containsProfilingIntrinsics(Module &M) {<br class="">+ if (auto *F = M.getFunction(<br class="">+ Intrinsic::getName(llvm::Intrinsic::instrprof_increment)))<br class="">+ return !F->use_empty();<br class="">+ if (auto *F = M.getFunction(<br class="">+ Intrinsic::getName(llvm::Intrinsic::instrprof_increment_step)))<br class="">+ return !F->use_empty();<br class="">+ if (auto *F = M.getFunction(<br class="">+ Intrinsic::getName(llvm::Intrinsic::instrprof_value_profile)))<br class="">+ return !F->use_empty();<br class="">+ return false;<br class="">+}<br class="">+<br class="">bool InstrProfiling::run(Module &M, const TargetLibraryInfo &TLI) {<br class="">+ // Improve compile time by avoiding linear scans when there is no work.<br class="">+ GlobalVariable *CoverageNamesVar =<br class="">+ M.getNamedGlobal(getCoverageUnusedNamesVarName());<br class="">+ if (!containsProfilingIntrinsics(M) && !CoverageNamesVar)<br class="">+ return false;<br class="">+<br class=""> bool MadeChange = false;<br class=""><br class=""> this->M = &M;<br class="">@@ -464,8 +484,7 @@ bool InstrProfiling::run(Module &M, cons<br class=""> for (Function &F : M)<br class=""> MadeChange |= lowerIntrinsics(&F);<br class=""><br class="">- if (GlobalVariable *CoverageNamesVar =<br class="">- M.getNamedGlobal(getCoverageUnusedNamesVarName())) {<br class="">+ if (CoverageNamesVar) {<br class=""> lowerCoverageData(CoverageNamesVar);<br class=""> MadeChange = true;<br class=""> }<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></blockquote><br class=""><br class=""><br class="">-- <br class="">Davide<br class=""><br class="">"There are no solved problems; there are only problems that are more<br class="">or less solved" -- Henri Poincare<br class=""></blockquote><br class=""></body></html>