[llvm] ValueTracking: teach implied-cond about samesign (PR #116614)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 18 07:03:49 PST 2024
artagnon wrote:
> Hm, why do other parts of isImpliedCond not benefit? I'd expect it to be useful at least for the isImpliedCondMatchingOperands and isImpliedCondOperands logic, possibly also isImpliedCondCommonOperandWithCR.
I did look at isImpliedCondMatchingOperands, which just calls isImplied{True,False}ByMatchingCmp. Wouldn't icmp samesign be canonicalized with unsigned predicates, and wouldn't the predicates either match or have LT => LE | NE and GT => GE | NE?
I also looked at isImpliedCondOperands, and due to the canonicalization, wouldn't LT + LE and GT + GE call isTruePredicate with LE + LE, and isn't the signed case in isTruePredicate strictly less powerful than the unsigned case?
I'm not too sure about isImpliedCondCommonOperandWithCR, but my reasoning is that getting signed ConstantRanges versus getting unsigned ConstantRanges for the same Values, in the context of comparing ranges, would make no difference.
> The code you're modifying here is a very special case -- it's probably exactly the one part of this code where I wouldn't bother with samesign support :)
I realized this too, but this seems to be the only legitimate opportunity.
https://github.com/llvm/llvm-project/pull/116614
More information about the llvm-commits
mailing list