[llvm] MathExtras: avoid unnecessarily widening types (PR #95426)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 29 06:35:23 PDT 2024


artagnon wrote:

> > Quick question: how do we measure the impact of this patch? I tried using LLVM Compile Time Tracker, but I didn't see any changes.
> 
> It does seem to have a mild negative effect: https://llvm-compile-time-tracker.com/compare.php?from=5cc1287bdbb2de9ad91e4ba8dc9eeb9508c734a5&to=56277948d577245be845c89a7d7c3a5ccd9747ef&stat=instructions:u
> 
> It might have been better to only do this for the divisions, not alignment, where this matters little but comes with cost due to the less efficient implementation that accounts for overflow.

Don't the align functions just use `divideCeil` and multiply by denominator? It looks like we have optimize the divide functions in InstCombine anyway (found from the previous patch), so wouldn't that also fix the regression in the align functions?

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


More information about the llvm-commits mailing list