[cfe-dev] split hot and cold part of a function into separate function

陈云星 via cfe-dev cfe-dev at lists.llvm.org
Thu May 6 19:42:30 PDT 2021


Because lots of code in a function was error/failure-handle code. The hot path of a function mostly very thin.

By use hot-cold-split, the hot part can keep more local and cluster.

Which help cpu i-cache hit.

I-cache miss hurt performance significantly.

> 2021年5月6日 下午7:11,chuanqi.xcq <yedeng.yd at linux.alibaba.com> 写道:
> 
> Now if we use --hot-cold-split, the compiler would tell us `unsupported option`. So I can't find simple example from compiler explorer.
> Here is the slides from the web: https://llvm.org/devmtg/2019-10/slides/Kumar-HotColdSplitting.pdf
> BTW, may I ask what's the intention for the question? Do we find that it is a performance gap from clang and gcc?
> 
> Thanks,
> Chuanqi
> 
> ------------------------------------------------------------------
> From:陈云星 <chen.yunxing at me.com>
> Send Time:2021年5月6日(星期四) 17:49
> To:chuanqi.xcq <yedeng.yd at linux.alibaba.com>
> Cc:cfe-dev <cfe-dev at lists.llvm.org>
> Subject:Re: [cfe-dev] split hot and cold part of a function into separate function
> 
> are there some example ?
> And this option -hot-cold-split need profile data ?
> 
> 2021年5月6日 下午5:16,chuanqi.xcq <yedeng.yd at linux.alibaba.com <mailto:yedeng.yd at linux.alibaba.com>> 写道:
> 
> Hi,
> 
> 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.
> 
> Thanks,
> Chuanqi
> 
> ------------------------------------------------------------------
> From:陈云星 via cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>>
> Send Time:2021年5月6日(星期四) 17:11
> To:cfe-dev <cfe-dev at lists.llvm.org <mailto:cfe-dev at lists.llvm.org>>
> Subject:[cfe-dev] split hot and cold part of a function into separate function
> 
> 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.
> 
> One example is here: https://godbolt.org/z/j7sK4hd48 <https://godbolt.org/z/j7sK4hd48>
> 
> my question is Clang/llvm has such function/capability ?
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210507/15997bd2/attachment.html>


More information about the cfe-dev mailing list