[llvm] [InstCombine] Prefer to keep power-of-2 constants when combining ashr exact and slt/ult of a constant (PR #86111)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 02:25:22 PDT 2024


dtcxzyw wrote:

> > The implementation LGTM. However, I don't see any performance improvement/regression according to the IR diff/instruction count. Can you provide some performance data for this patch? I guess it requires the zbs extension.
> 
> Yes, I'd expect no real difference without zbs. I don't have performance figures for a full benchmark suite - I was analysing bedcov.c from https://github.com/attractivechaos/plb2 vs GCC and although it doesn't show up high on the profile, noted gcc managed to select `bseti` where we didn't. I thought this might be a simple missed isel pattern and of course ended up finding it was related to us choosing a harder to efficiently generate constant in InstCombine.

The IR diff basically looks fine to me. I am investigating the regression in pbrt-v4: https://github.com/dtcxzyw/llvm-opt-benchmark/pull/589/files#r1592080470


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


More information about the llvm-commits mailing list