This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify] Simplify comparison between zext(x) and sext(x)
ClosedPublic

Authored by nikic on Jul 2 2020, 1:30 PM.

Details

Summary

This is picking up a loose thread from D69006: We can simplify (zext x) ule (sext x) and (zext x) sge (sext x) to true, with various permutations. Oddly, SCEV knows about this identity, but nothing on the IR level does.

Alive is happy: https://gist.github.com/nikic/7bd5e2ce0dda5ef4c3e712a707f5d0f7

Diff Detail

Event Timeline

nikic created this revision.Jul 2 2020, 1:30 PM
spatel accepted this revision.Jul 3 2020, 2:45 PM

LGTM, but you should adjust at least a couple of the tests to use vector types so we have better coverage.

This revision is now accepted and ready to land.Jul 3 2020, 2:45 PM
This revision was automatically updated to reflect the committed changes.