isKnownNonEqual(A, B) returns true if it can be determined that A != B.
At the moment it only knows one fact, that a non-wrapping add of nonzero to a value cannot be that value:
A + B != A [where B != 0, addition is nsw or nuw]
jmolloy on Sep 11 2015, 5:55 AM.Authored by
I don't think you need to check for no-wrap -- a non-zero B should be sufficient to prove A + B != A.
I like the idea of this function, but I'm somewhat nervous of adding such a generic facility with such a limited implementation. It would make me feel much better if it also had the following check: call computeKnownBits on V1 and V2, and return true if any of the bits known to be 1 in one value are known to be zero in the other. That would naturally leverage much more of the existing infrastructure.
Also, I assume you're planning on soon using this somewhere?
You can ignore this; I see you're using it in D12801.
Hi Hal, Sanjoy,
Thanks for the review. I've addressed both your comments, and:
Some minor comments inline.
Thanks for the comments. Switching to PatternMatch was a good idea - the code is substantially more readable!
All comments acted upon.