Both patterns where missed because they go through a level of
indirection:
- A > C1 && A < C2 cannonicalizes to ICMP_ULT (A + C3, C4)
- Try and match this pattern explicitly in isKnownNonNullFromDominatingCondition
- A & B != C
- Since cmp ne (A & B, 0) implies cmp ne (A, 0) just match that as an additional generic pattern in isKnownNonNullFromDominatingCondition. This was already done in the final worklist loop.
The rationale is C-code like:
int foo(int A, int B) { if(A % 2 == 0) { // A is provably odd but `isKnownNonZero(A)` will not find any // cmp directly acting on A. The same applies for the ICMP_ULT // case. return !!(A * B); } ... }