[llvm] [InstCombine] Set !prof metadata on Selects identified by add.ll test (PR #158743)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 16 12:01:41 PDT 2025


nikic wrote:

> > That also sounds reasonable to me. I assume checking for a non-zero function entry count is not particularly expensive?
> 
> It's fetching a function metadata, and should't be expensive. We can also cache this over the whole pass rather than checking more locally.

A cache is probably not needed, so let's start without it.

It would be nice to have a helper for this though, I'd expect this to be a rather common pattern for InstCombine in particular, so if we could just replace `SelectInst::Create()` with `createSelectWithUnknownBranchWeights()` that would be nice.

https://github.com/llvm/llvm-project/pull/158743


More information about the llvm-commits mailing list