[llvm] [ValueTracking] Extend LHS/RHS with matching operand to work without constants. (PR #85557)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 17 09:30:45 PDT 2024


nikic wrote:

> > Yeah, I can't say I'm particularly fond of the direction.
> > From the test diffs, a fold we're missing is this: https://alive2.llvm.org/ce/z/-njJr8 Particularly profitable if the new comparison folds later, but also seems generally beneficial.
> 
> Would think its more principled to more generally handle the implication between conditions rather than add a transform for each possible case.

This is still an implied condition based transform. In fact, now that I look for it, it seems like foldSelectICmp() should be doing exactly that. I think maybe it doesn't trigger because the condition becomes `icmp eq 2, %x` and we need to handle non-canonical icmp order in isImpliedCond.

(This is not intended as a full replacement for what you want here, just something I noticed in the tests.)

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


More information about the llvm-commits mailing list