[llvm] [LoopUnroll] Allow expensive trip count emitting which is estimated to be infinite (PR #79869)

Aleksandr Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 04:27:08 PST 2024


aleks-tmb wrote:

> I'm curious what motivated this change - I've seen "infinite" trip counts in message pump type of code, like:
> 
> ```
> while (true) {
>   auto msg = queue.dequeue(); // blocking
>   msg->doYourThing();
> }
> ```
> 
> This appears on server side. The loop is actually cold, and not really worth optimizing, so I'm curious to learn what other real-world cases of "infinite loops" are there.

It's a benchmark we have with a loop that does a huge number of iterations. And the `1:0` branch weights ratio is a way of how our runtime represents it.

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


More information about the llvm-commits mailing list