[llvm] [InstCombine] Treat umax as select(icmp eq x, 0), 1, x) in binop select fold. (PR #65978)

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 10:41:31 PST 2023


davemgreen wrote:

Hi - thanks for taking a look and sorry this took a while to get back to. This was causing some regressions in my motivating case due to knock-on register allocation. That should hopefully be resolved now and so it leads to an improvement as you would expect.

I've been looking at trying to generalize it to more cases and deal with the undef. I'll update this patch with the more special case, which the general case can be added to but is more complex. I think I have it working, but have to check through some of the details.

Unfortunately it appears some cases are not valid with undef arguments. I've tried to limit it to valid cases (as opposed to adding freeze).  I know that undef can be odd at times but I'm not sure it should be this odd.

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


More information about the llvm-commits mailing list