This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Add logic for `isKnownNonZero(smin/smax X, Y)`
ClosedPublic

Authored by goldstein.w.n on Apr 27 2023, 11:21 PM.

Details

Summary

For smin if either X or Y is negative, the result is non-zero.
For smax if either X or Y is strictly positive, the result is
non-zero.

For both if X != 0 and Y != 0 the result is non-zero.

Alive2 Link:

https://alive2.llvm.org/ce/z/7yvbgN
https://alive2.llvm.org/ce/z/zizbvq

Diff Detail

Event Timeline

goldstein.w.n created this revision.Apr 27 2023, 11:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2023, 11:21 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
goldstein.w.n requested review of this revision.Apr 27 2023, 11:21 PM
nikic accepted this revision.Apr 28 2023, 1:55 AM

LGTM

llvm/lib/Analysis/ValueTracking.cpp
2964

The formatting here is ugly enough that I'd just repeat the two lines from umin :)

This revision is now accepted and ready to land.Apr 28 2023, 1:55 AM
This revision was landed with ongoing or failed builds.Apr 30 2023, 8:08 AM
This revision was automatically updated to reflect the committed changes.