<div class="__aliyun_email_body_block"><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Sorry for the late reply. T</span><span  style="font-size:14.0px;">hanks everyone for looking into this!</span></div><div  style="clear:both;"><span  style="font-size:14.0px;"><br ></span></div><div  style="clear:both;">> To Sjoerd Meijer:</div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">>> This general direction is that we change the cost-model, import more functions as a result, so that we can do more transformations. The questions that need answering are: what is this going to cost in  compile-times, and what is the performance benefit?</span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">For the cost and beneift, I marked them in `https://reviews.llvm.org/D105966`. Simply, for compile-time, there is no significant change except 502.gcc_r increased 30%. For code-size, the average increasement is 6.7%. And the maximum is 19%. For the performance benefit, the ThinLTO for function specialization version gains all the benefit from FullLTO version. </span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">Obiviously, the number are not so satisfying and this is the reason I marked that patch as WIP. The things I want to say is:</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">- The increasement for compile-time and code-size mainly comes the newly imported functions been specialized. Instead of calculating and storing the extra heuristics.</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">- The main purpose of this mail is to make sure we are on the right direction. In other words, ThinLTO for function specialization is pursued.</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> To Sjoerd Meijer:</span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">>> <span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">To have a more efficient discussion on this, I think it is best if you prototype your proposal. This makes things more concrete and also allows to get some first costs and benefits of the approach to test the whole idea. Without this, it all just remains a bit abstract.</span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Yeah, I thought I made the proposal in D105524, D105966 and D107136.  Since the codes for function specialization changes relatively fast. It may not be applied directly. I would try to rebase it recently.</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Another way to measure it is to `git reset --hard d4840175c95f6edcba21baae411589468`.</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> To Sjoerd Meijer:</span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">>> <span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;text-decoration:none;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:black;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;background-color:#ffffff;display:inline;font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;">Regarding </span><span  class=" __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;background-color:white;display:inline;"><a  href="https://reviews.llvm.org/D105524" target="_blank" style="margin:.0px;">https://reviews.llvm.org/D105524</a></span><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;background-color:#ffffff;display:inline;font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;">, yes </span></span><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;text-decoration:none;font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;background-color:#ffffff;">it is NFC and harmless, but it is not important. I.e., it is trivial and I'm sure we can get it approved in no-time</span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;text-decoration:none;font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;background-color:#ffffff;"><br ></span></span></div><div  style="clear:both;"><span  style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;">The problem is that <span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">function specialization gets changed fast. So that this patch couldn't be approved directly. It may be an extra cost. If we decide the ThinLTO for function specialization is a long-term direction, we should check it in first to avoid extra cost.</span></span></div><div  style="clear:both;"><span  style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> To <span  style="caret-color:#000000;color:#000000;font-family:Calibri,sans-serif;font-size:15.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Teresa Johnson:</span></span></span></div><div  style="clear:both;"><span  style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">>> <span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">One important thing to note is that we import functions with available_externally linkage, because they still live in their original translation unit. The intention is to make them available for inlining, and then they get dropped. But specialization presumably mainly benefits the out of line copy, I think? So I'm not sure that the approach of allowing the specialization candidates to get imported will ultimately do what you want.</span></span></span></div><div  style="clear:both;"><span  style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">For imported functions with </span><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">available_externally linkage, </span><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">the strategy now is that if we decide to specialize it, we would copy the importanted function and change the linkage for cloned to local so that it wouldn't affect other translation unit. It looks fine to me.  Correct me if there is any problems. Since linking is really magic.</span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> To </span><span  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;font-family:Calibri,sans-serif;font-size:15.0px;float:none;display:inline;">Teresa Johnson:</span></span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">>> <span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">It probably would be better to allow the necessary info to be propagated via the index back to the original TU so that it can be specialized in its original location.</span></span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">It looks hard to do. I think the key point is that we make decision to specialize functions in the process of ThinLTO compiling, which is pararrel to other compilation unit. It looks like we need to do synchronization for ThinLTO, which sounds like to violate the design principles for ThinLTO.</span></span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> <span  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;caret-color:#000000;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;text-decoration:none;background-color:#ffffff;float:none;display:inline;">To </span><span  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;text-decoration:none;background-color:#ffffff;font-family:Calibri,sans-serif;font-size:15.0px;float:none;display:inline;">Teresa Johnson:</span></span></span></span></div><div  style="clear:both;"><span  style="caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> Agree with others that the solution should be prototyped so you can show some results in terms of not only the benefit, but also the cost. I.e. adding information about all of the function arguments will increase the size of the index - how significant is that increase? We want to ensure that the thin link portion of the ThinLTO build stays efficient as that is the only monolithic, serial portion of a ThinLTO build.</span></span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">It's a great point to measure the size increased for index. I forget to measure it before. Then here are the numbers for SPEC2017 int. The method I used to measure the size for index is to compile the sizefor the `.o` objects compiled by `-flto=thin`. Correct me if the measurement is not precise.</span></div><div  style="clear:both;"></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">The results shows that for SPEC2017 intrate, the overall increased size is about  2.8%. More precisely,</span></div><div  style="clear:both;"></div><div  style="clear:both;"></div><div  style="clear:both;"><br ></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">| benchamrk       | size change for all the .o files |<br >|-----------------|--------|<br >| 500.perlbench_r | +1.9%  |<br >| 502.gcc_r       | +3.8%  |<br >| 505.mcf_r       | +3%    |</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">| 520.omnetpp_r | +12% |</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">| 525.x264_r | +2.9% |</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">| 531.deepsjeng_r | +1.4% |</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">| 541.leela_r | +2% |</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">The size changes less than 1% are omitted.</span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">><span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"> </span><span  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;float:none;display:inline;">To </span><span  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;caret-color:#000000;color:#000000;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;font-family:Calibri,sans-serif;font-size:15.0px;float:none;display:inline;">Teresa Johnson:</span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">>> <span  style="caret-color:#000000;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">That being said, I think it is a great idea to try to extend function specialization to ThinLTO if it is giving good benefits with regular LTO.</span></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;">Thanks for your approval for the direction very much!</span></div><div  style="clear:both;"><br ></div><div  style="clear:both;">Thanks,</div><div  style="clear:both;">Chuanqi</div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><blockquote  style="margin-right:0;margin-top:0;margin-bottom:0;"><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:Sjoerd Meijer <Sjoerd.Meijer@arm.com></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2021年7月28日(星期三) 18:57</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:Teresa Johnson <tejohnson@google.com></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Cc:llvm-dev <llvm-dev@lists.llvm.org>; Florian Hahn <florian_hahn@apple.com>; chuanqi.xcq <yedeng.yd@linux.alibaba.com></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [llvm-dev] [ThinLTO] Import functions to enable function specialization in ThinLTO</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><style  type="text/css">P{margin-top:0;margin-bottom:0;}</style><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;">
Many thanks for commenting on the ThinLTO part and the suggestions how to approach this!</div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;">
I also think that specialisation benefits the out of line copy. </div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;"><br ></div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;">
Cheers,<br >
Sjoerd.</div><div  id="appendonsend"></div><hr  style="display:inline-block;width:98.0%;"><div  id="divRplyFwdMsg"><span  style="font-size:15.0px;color:#000000;font-family:Calibri,sans-serif;"><b >From:</b> Teresa Johnson <tejohnson@google.com><br ><b >Sent:</b> 27 July 2021 16:00<br ><b >To:</b> Sjoerd Meijer <Sjoerd.Meijer@arm.com><br ><b >Cc:</b> llvm-dev <llvm-dev@lists.llvm.org>; Florian Hahn <florian_hahn@apple.com>; chuanqi.xcq <yedeng.yd@linux.alibaba.com><br ><b >Subject:</b> Re: [llvm-dev] [ThinLTO] Import functions to enable function specialization in ThinLTO</span><div > </div></div><div ><div >I can answer questions from the ThinLTO standpoint. Missed the earlier emails on this, but I just skimmed the other llvm-dev email and the patch. I have a high level question and can give some thoughts on the approach from a ThinLTO standpoint.
<div ><br ></div><div >One important thing to note is that we import functions with available_externally linkage, because they still live in their original translation unit. The intention is to make them available for inlining, and then they get dropped. But specialization presumably
 mainly benefits the out of line copy, I think? So I'm not sure that the approach of allowing the specialization candidates to get imported will ultimately do what you want. It probably would be better to allow the necessary info to be propagated via the index
 back to the original TU so that it can be specialized in its original location.</div><div ><br ></div><div >Agree with others that the solution should be prototyped so you can show some results in terms of not only the benefit, but also the cost. I.e. adding information about all of the function arguments will increase the size of the index - how significant
 is that increase? We want to ensure that the thin link portion of the ThinLTO build stays efficient as that is the only monolithic, serial portion of a ThinLTO build. That being said, I think it is a great idea to try to extend function specialization to ThinLTO
 if it is giving good benefits with regular LTO.</div><div ><br ></div><div >Teresa</div></div><br ><div  class="x_gmail_quote"><div  class="x_gmail_attr">On Tue, Jul 27, 2021 at 5:56 AM Sjoerd Meijer via llvm-dev <<a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br ></div><div ><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;">
The motivation for this work was getting this working ThinLTO, which I know very little about that, so that's why I recommended getting buy in from ThinLTO folks for the general direction.</div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;"><br ></div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;">
This general direction is that we change the cost-model, import more functions as a result, so that we can do more transformations. The questions that need answering are: what is this going to cost in compile-times, and what is the performance benefit?</div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;"><br ></div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;">
To have a more efficient discussion on this, I think it is best if you prototype your proposal. This makes things more concrete and also allows to get some first costs and benefits of the approach to test the whole idea. Without this, it all just remains a
 bit abstract.</div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;"><br ></div><div  class=" __aliyun_node_has_color" style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16.0px;color:#000000;"><div  class=" __aliyun_node_has_color" style="margin:.0px;font-size:15.0px;color:#201f1e;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:black;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;background-color:#ffffff;display:inline;font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;">Regarding
</span><span  class=" __aliyun_node_has_bgcolor" style="margin:.0px;background-color:white;display:inline;"><a  href="https://reviews.llvm.org/D105524" target="_blank" style="margin:.0px;">https://reviews.llvm.org/D105524</a></span><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;background-color:#ffffff;display:inline;font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;">,
 yes </span></span><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;background-color:#ffffff;">it is NFC and harmless, but it is not important. I.e., it is trivial and I'm sure we can get it approved in
 no-time, but more important are the bigger questions that needs answers first. It's also better to avoid unnecessary churn if things turns out to be different.</span></div><div  class=" __aliyun_node_has_color" style="margin:.0px;font-size:15.0px;color:#201f1e;clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;background-color:#ffffff;"><br ></span></div><div  class=" __aliyun_node_has_color" style="margin:.0px;font-size:15.0px;color:#201f1e;clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;background-color:#ffffff;">My 2 cents.</span></div><div  class=" __aliyun_node_has_color" style="margin:.0px;font-size:15.0px;color:#201f1e;clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="font-family:calibri,arial,helvetica,sans-serif;font-size:16.0px;color:#000000;background-color:#ffffff;">Sjoerd.</span></div></div><div  id="x_gmail-m_4179446858562089319appendonsend"></div><hr  style="display:inline-block;width:98.0%;"><div  id="x_gmail-m_4179446858562089319divRplyFwdMsg"><span  style="font-size:15.0px;color:#000000;font-family:Calibri,sans-serif;"><b >From:</b> llvm-dev <<a  href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>>
 on behalf of chuanqi.xcq via llvm-dev <<a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>><br ><b >Sent:</b> 26 July 2021 07:30<br ><b >To:</b> llvm-dev <<a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>; Florian Hahn <<a  href="mailto:florian_hahn@apple.com" target="_blank">florian_hahn@apple.com</a>><br ><b >Subject:</b> Re: [llvm-dev] [ThinLTO] Import functions to enable function specialization in ThinLTO</span><div > </div></div><div ><div ><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">gentle ping~</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:llvm-dev <<a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2021年7月15日(星期四) 17:23</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:llvm-dev <<a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>>; Florian Hahn <<a  href="mailto:florian_hahn@apple.com" target="_blank">florian_hahn@apple.com</a>></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [llvm-dev] [ThinLTO] Import functions to enable function specialization in ThinLTO</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Hi <span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Florian,</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Thanks
 for looking into this!</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> I’d
 try to summarise the heuristics you propose to add, rather than focusing on the implementation details to start with.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;">Thanks. I agree with it. The direction are more important than details.</div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;">> <span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">You
 should also be able to collect and provide date on the effectiveness of those heuristics, like the number of additional functions imported, compared to the number of additionally specialised  functions.</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">If
 I understand right, you mean that I could collect these numbers after we summarised the heuristics we decide to use instead of collecting now.</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Collecting
 the numbers may not make sense to me. Since I think we should do statistics after we decided the direction.</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> Also,
 the scope/focus on function specialisation seems a bit narrow for substantially increasing the number of imported functions.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">I
 think there are two apsects.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">-
 It depends on how much we could get from function specialization.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">-
 It depends the cost model to import more functions.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">For
 the first aspects, I think function specialization is potential because ipa-cp plays an important role in gcc.
</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">And
 the interprocedural value range propogation based on function specialization seems very potential to me.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">That's
 the reason that I want to look into function specialization.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">For
 the second aspects, I think we need more time to tuning it. Or in another words, we need to decide the heuristics first.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">I
 know it's hard to **decide**  heuristics without measuring. But the work process  I imaged maybe:</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">```</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Get
 a set of heuristics -> Tuning the cost model to decrease the overhead -> if succed, we got it -> else go back to the first step.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">```</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">> Do
 you think the proposed heuristics would also benefit other optimisations, like regular IPSCCP?</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Yes,
 I think regular IPSCCP could benefit from the proposed heuristics. Out of curiousty, I guess we could replace regular IPSCCP</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">once
 the function specialization pass is strong enough. What's your opinion?</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Finally,
 let me clarify the intention of this mail. I don't ask to get a solution right now. I know it is hard for every one.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">The
 intention is that if we could get a consensus that it is valuable that importing functions by heuristics for function specialization.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">If
 yes, we could continue the review process for <a  href="https://reviews.llvm.org/D105524" target="_blank">https://reviews.llvm.org/D105524</a>, which extract the analysis part from function
</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">specialization
 pass. I believe this patch should be NFC and harmless.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Of
 course, it could much much better that we could discuss the heuristics and the cost model.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Let
 me introduce the heuristics and the cost model I proposed simply.</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">The heuristics
 are:</span></span></div><div  style="clear:both;"><ul  class=" __aliyun_node_has_color" style="font-style:normal;font-variant-caps:normal;font-weight:normal;text-indent:.0px;text-transform:none;text-decoration:none;margin:12.0px .0px 12.0px 30.0px;padding:.0px;border:.0px;list-style:disc;color:#000000;font-family:Segoe UI,Segoe UI Emoji,Segoe UI Symbol,Lato,Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13.0px;text-align:left;"><li  style="margin:.0px;padding:.0px;border:.0px;line-height:1.7em;">Specialize Function Cost. An unsigned number, which is an estimation for the cost to clone one function.</li><li  style="margin:.0px;padding:.0px;border:.0px;line-height:1.7em;">Base Bonus for specializing specific argument. A map from ArgNo to the corresponding base bonus. Here the base bonus means the bonus we could calculate by visiting the function body itself only
 (in other words, doesn't need to see the call site).</li><li  style="margin:.0px;padding:.0px;border:.0px;line-height:1.7em;">ArgUsage. A map from ArgNo to the extra bonus for each call site. The extra bonus means the bonus we could calculate for specific call site. For example, if we passed a function in the call,
 we could calculate the possibility that the function could get inlined at the specific call site only.</li></ul><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">And the cost model are the same with function specialization pass right now and we could adjust it in the future.</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">The first one `<span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Segoe UI,Segoe UI Emoji,Segoe UI Symbol,Lato,Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:left;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Specialize
 Function Cost</span>` is the number of instruction in a function multiplies a factor.</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">The second one `Base Bonus` is calculated by how many possible loads for this argument and its alias now.
</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">I plan to add more situations for example:</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">```</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">int foo(bool cond) {</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">   if (cond) { // We could get more base bonus by the average instruction count in the branches.</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">   } else {</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">   }</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">}</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">```</span></div></div><div  style="clear:both;"><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Or</span></div></div><div  style="clear:both;"><div  style="clear:both;"><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">```</span></div></div><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">int foo(int cond) {</span></div></div><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">   if (cond > 10) { // We could get the condition
 if cond is constant, so we could get more bonus.</span></div></div><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">   } else {</span></div></div><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">   }</span></div></div><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">}</span></div></div><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"><span  class=" __aliyun_node_has_color" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">```</span></div></div></div></div><div  style="clear:both;"><div  style="clear:both;"><div  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="margin:.0px;padding:.0px;border:.0px;outline:.0px;color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;clear:both;"><div  style="margin:.0px;padding:.0px;border:.0px;outline:.0px;clear:both;"></div></div><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">The third one `<span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Segoe UI,Segoe UI Emoji,Segoe UI Symbol,Lato,Helvetica Neue,Helvetica,Arial,sans-serif;font-size:13.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:left;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">ArgUsage</span>`,
 which describes the infomation in callsites and we could use it to calculate the extra bonus.</span></div></div><div  style="clear:both;"><div  style="clear:both;">Now it only contains the instruction count if the corresponding parameter is a function. Then we could get extra bonus</div></div><div  style="clear:both;"><div  style="clear:both;">from the potential inlining.</div></div><div  style="clear:both;"></div><div  style="clear:both;"><br ></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Thanks,</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Chuanqi</span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><span  class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#000000;font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">------------------------------------------------------------------</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">From:Florian Hahn <<a  href="mailto:florian_hahn@apple.com" target="_blank">florian_hahn@apple.com</a>></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Send Time:2021年7月14日(星期三) 19:39</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">To:chuanqi.xcq <<a  href="mailto:yedeng.yd@linux.alibaba.com" target="_blank">yedeng.yd@linux.alibaba.com</a>>; llvm-dev <<a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;">Subject:Re: [llvm-dev] [ThinLTO] Import functions to enable function specialization in ThinLTO</span></div><div  style="clear:both;"><span  class=" __aliyun_node_has_color" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;color:#000000;"><br ></span></div><br ><div ><br ><div >On 14 Jul 2021, at 09:38, chuanqi.xcq via llvm-dev <<a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br ><div ><div ><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">Hi all,</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><br ></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">Before I sent a mail to ask the opinion to how to import functions to enable function specialization in ThinLTO.</span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">Maybe the question is too empty or the <span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">function
 specialization pass didn't get checked in at that time. So I didn't get responses.</span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Then
 now, the function specialization passes got checked in and I also made it a version in the downstream.</span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">So
 I tried to update my patches. The first patch is to extract the analysis part of function specialization as an analysis pass.</span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">(<a  href="https://reviews.llvm.org/D105524" target="_blank">https://reviews.llvm.org/D105524</a>).</span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">And
<span  class=" __aliyun_node_has_color" title="sjoerd.meijer@arm.com" style="border:none;margin:.0px 2.0px .0px .0px;background-color:transparent;color:#0284c0;">
@sjoerd.meijer</span> suggests that it may be better that I ping this thread with more infomation to make us confident we are</span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">in
 the right direction.</span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;"><br ></span></span></div><div  style="clear:both;"><span  style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><span  class=" __aliyun_node_has_bgcolor" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;font-style:normal;font-variant-caps:normal;font-weight:normal;text-align:start;text-indent:.0px;text-transform:none;background-color:#ffffff;text-decoration:none;float:none;display:inline;">Then
 I updated this one: <a  href="https://reviews.llvm.org/D105966" target="_blank">https://reviews.llvm.org/D105966</a>, which contains the detailed description and numbers.</span></span></div><div  style="clear:both;">Response in this thread or in that review page is fine to me either.</div><div  style="clear:both;"><br ></div></div></div><br ></div><div ><br ></div><div >I’d try to summarise the heuristics you propose to add, rather than focusing on the implementation details to start with. I think it might be helpful to motivate a set of heuristics first. You should also be able to collect and provide date on the effectiveness
 of those heuristics, like the number of additional functions imported, compared to the number of additionally specialised  functions.</div><div ><br ></div><div >Also, the scope/focus on function specialisation seems a bit narrow for substantially increasing the number of imported functions. Do you think the proposed heuristics would also benefit other optimisations, like regular IPSCCP?</div><div ><br ></div><div >Cheers,</div><div >Florian</div><br ><div ><br ></div></div></div></div>
_______________________________________________<br >
LLVM Developers mailing list<br ><a  href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br ><a  href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br ></div><br  clear="all"><div ><br ></div>
-- <br ><div  class="x_gmail_signature"><div ><div ><span  style="font-family:Times;font-size:medium;"><table  cellpadding="0" cellspacing="0"><tbody ><tr  class=" __aliyun_node_has_color" style="color:#555555;font-family:sans-serif;font-size:small;"><td  nowrap="" style="border-top-width:2.0px;border-top-style:solid;border-top-color:#d50f25;">Teresa Johnson |</td><td  nowrap="" style="border-top-width:2.0px;border-top-style:solid;border-top-color:#3369e8;"> Software Engineer |</td><td  nowrap="" style="border-top-width:2.0px;border-top-style:solid;border-top-color:#009939;"> <a  href="mailto:tejohnson@google.com" target="_blank">tejohnson@google.com</a> |</td><td  nowrap="" style="border-top-width:2.0px;border-top-style:solid;border-top-color:#eeb211;"><br ></td></tr></tbody></table></span></div></div></div></div></blockquote><div ><br ></div></div>