HomePhabricator

[InstCombine] Generalize icmp handling in isKnownNonZero()

Authored by nikic on Dec 25 2020, 3:28 AM.

Description

[InstCombine] Generalize icmp handling in isKnownNonZero()

The dominating condition handling in isKnownNonZero() currently
only takes into account conditions of the form "x != 0" or "x == 0".
However, there are plenty of other conditions that imply non-zero,
a common one being "x s> 0".

Peculiarly, the handling for assumes was already dealing with more
general non-zero-ness conditions, so this just reuses the same
logic for the dominating condition case.

Details

Committed
nikicDec 25 2020, 7:49 AM
Parents
rGb0e6007c8254: [InstCombine] Add additional tests for known non zero (NFC)
Branches
Unknown
Tags
Unknown

Event Timeline

xbolva00 added inline comments.
/llvm/test/Transforms/Attributor/nonnull.ll
1420

Not marked as nonnull

nikic added inline comments.Dec 25 2020, 9:09 AM
/llvm/test/Transforms/Attributor/nonnull.ll
1420

Yes, this works only with NPM, as the needed per-function analysis results are not available in LPM.