[llvm] [profcheck] Fix encoding of 0 loopEstimatedTrip count (PR #174896)

Joel E. Denny via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 26 16:01:55 PST 2026


jdenny-ornl wrote:

> IIUC the presence of `llvm.loop.estimated_trip_count` shouldn't require relying on the 0-0 branch weights, correct?  The problem with the 0-0 branch weights is that they could lead to really off BFI info (see the examples in [this](https://github.com/llvm/llvm-project/pull/175096) commit message). I think this highlights even more why we want `llvm.loop.estimated_trip_count` in the first place, no?

Good point.  And eventually the weight parameter of `{set,get}LoopEstimatedTripCount` should go away anyway.

To make it easier to keep all this straight in the meantime, would you please update `setLoopEstimatedTripCount` comments in `LoopUtils.h` not to claim it zeroes branch weights?  Please point out that it is intentionally setting the branch weights to indicate a count of 1 as there are no valid branch weights that indicate 0.



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


More information about the llvm-commits mailing list