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

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 11 15:21:50 PST 2024


mtrofin 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.

Thanks. By "our runtime represents it" you mean the branch probabilities are inserted via a different mechanism than the one in LLVM?

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


More information about the llvm-commits mailing list