[llvm] [InstCombine] Fold shl of constant by cttz into multiply of lowest set bit (PR #214517)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 16 02:08:36 PDT 2026


dtcxzyw wrote:

> Should this fold be implemented in codegen instead? It introduced regressions on both aarch64 and x86.

See https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/926/files. In some cases the mul will be removed by other middle-end optimizations. The backend should recognize this pattern and revert the transform.

I am worried that is_zero_poison may not be re-inferred in SDAG. If this is a bottleneck, we have to implement this fold in DAGCombiner.

cc @RKSimon 

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


More information about the llvm-commits mailing list