<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Because lots of code in a function was error/failure-handle code. The hot path of a function mostly very thin.<div class=""><br class=""></div><div class="">By use hot-cold-split, the hot part can keep more local and cluster.</div><div class=""><br class=""></div><div class="">Which help cpu i-cache hit.</div><div class=""><br class=""></div><div class="">I-cache miss hurt performance significantly.</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">2021年5月6日 下午7:11,chuanqi.xcq <<a href="mailto:yedeng.yd@linux.alibaba.com" class="">yedeng.yd@linux.alibaba.com</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><div class="__aliyun_email_body_block"><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">Now if we use --hot-cold-split, the compiler would tell us `unsupported option`. So I can't find simple example from compiler explorer.</span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">Here is the slides from the web: <a href="https://llvm.org/devmtg/2019-10/slides/Kumar-HotColdSplitting.pdf" class="">https://llvm.org/devmtg/2019-10/slides/Kumar-HotColdSplitting.pdf</a></span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">BTW, may I ask what's the intention for the question? Do we find that it is a performance gap from clang and gcc?</span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class=""><br class=""></span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">Thanks,</span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">Chuanqi</span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class=""><br class=""></span></div><blockquote style="margin-right:0;margin-top:0;margin-bottom:0;" class=""><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">------------------------------------------------------------------</span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">From:陈云星 <<a href="mailto:chen.yunxing@me.com" class="">chen.yunxing@me.com</a>></span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">Send Time:2021年5月6日(星期四) 17:49</span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">To:chuanqi.xcq <<a href="mailto:yedeng.yd@linux.alibaba.com" class="">yedeng.yd@linux.alibaba.com</a>></span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">Cc:cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>></span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class="">Subject:Re: [cfe-dev] split hot and cold part of a function into separate function</span></div><div style="clear:both;" class=""><span style="font-family: Tahoma, Arial, STHeiti, SimSun; font-size: 14px;" class=""><br class=""></span></div>are there some example ?<div class=""><span class=" __aliyun_node_has_color __aliyun_node_has_bgcolor" style="color:#242729;font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,sans-serif;font-size:13.0px;font-variant-ligatures:normal;widows:2;background-color:#e4e6e8;text-decoration-thickness:initial;">And this option -hot-cold-split need profile data ?</span><br class=""><div class=""><br class=""><div class="">2021年5月6日 下午5:16,chuanqi.xcq <<a class="" href="mailto:yedeng.yd@linux.alibaba.com" target="_blank">yedeng.yd@linux.alibaba.com</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">Hi,</span></div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><br class=""></span></div><div class="" style="clear:both;">IIRC, clang/llvm has HotColdSplit and partial inline passes which has similar functionality. However, these two passes are not enabled by default for some reasons.</div><div class="" style="clear:both;"><br class=""></div><div class="" style="clear:both;">Thanks,</div><div class="" style="clear:both;">Chuanqi</div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><br class=""></span></div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">------------------------------------------------------------------</span></div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">From:陈云星 via cfe-dev <<a class="" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span></div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">Send Time:2021年5月6日(星期四) 17:11</span></div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">To:cfe-dev <<a class="" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span></div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;">Subject:[cfe-dev] split hot and cold part of a function into separate function</span></div><div class="" style="clear:both;"><span class="" style="font-family:Tahoma,Arial,STHeiti,SimSun;font-size:14.0px;"><br class=""></span></div>currently, gcc support function attribute “cold”, which can hint compiler split caller function’s cold into two separate function, one is hot the other is cold.<div class=""><br class=""></div><div class="">One example is here: <a class="" href="https://godbolt.org/z/j7sK4hd48" target="_blank">https://godbolt.org/z/j7sK4hd48</a></div><div class=""><br class=""></div><div class="">my question is Clang/llvm has such function/capability ?</div><div class=""><br class=""></div></div></div><br class=""></div></blockquote><div class=""><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>