This is an archive of the discontinued LLVM Phabricator instance.

[SCEV] Support negative values in signed/unsigned predicate reasoning
ClosedPublic

Authored by mkazantsev on Sep 17 2021, 3:19 AM.

Details

Summary

There is a piece of logic that uses the fact that signed and unsigned versions of the
same predicate are equivalent when both values are non-negative. It's also true when
both of them are negative.

Diff Detail

Event Timeline

mkazantsev created this revision.Sep 17 2021, 3:19 AM
mkazantsev requested review of this revision.Sep 17 2021, 3:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2021, 3:19 AM
nikic accepted this revision.Sep 17 2021, 2:38 PM

LGTM

This revision is now accepted and ready to land.Sep 17 2021, 2:38 PM

It would be really good to implement this same logic in Utils/SimplifyIndVars.cpp where we canonicalize comparisons to unsigned for the known-non-negative case. @mkazantsev Can I ask you to implement that as a follow up please?