[llvm] [InstCombine] Fold max(max(x, c1) << c2, c3) —> max(x << c2, c3) when c3 >= c1 * 2 ^ c2 (PR #140526)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat May 24 01:37:19 PDT 2025


dtcxzyw wrote:

> solution 1 was already available so i didn't make it.

`c << shamt` has been constant folded so that instcombine doesn't catch this pattern. Godbolt: https://godbolt.org/z/rndGjEE31

> I only concentrated on solution 2

Yeah. I think it is a better solution.


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


More information about the llvm-commits mailing list