This is an archive of the discontinued LLVM Phabricator instance.

[KnownBits] Add implementations for saturating add/sub functions
ClosedPublic

Authored by goldstein.w.n on May 7 2023, 11:59 PM.

Details

Summary

These where previously missing. Even in the case where overflow is
indeterminate we can still deduce some of the low/high bits.

Diff Detail

Event Timeline

goldstein.w.n created this revision.May 7 2023, 11:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2023, 11:59 PM
goldstein.w.n requested review of this revision.May 7 2023, 11:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2023, 11:59 PM
RKSimon added inline comments.May 8 2023, 3:47 AM
llvm/include/llvm/Support/KnownBits.h
335

(style) Description comments

llvm/lib/Support/KnownBits.cpp
478

This might be worth changing into a KnownBits::isSignBitKnown() helper method?

goldstein.w.n added inline comments.May 8 2023, 6:52 PM
llvm/lib/Support/KnownBits.cpp
478

This might be worth changing into a KnownBits::isSignBitKnown() helper method?

Is this used/desired elsewhere?

goldstein.w.n marked an inline comment as done.May 8 2023, 8:02 PM

Comments in header. Check input/output

RKSimon accepted this revision.May 13 2023, 4:26 AM

LGTM

llvm/lib/Support/KnownBits.cpp
478

I thought I'd had to use a similar pattern in the past, but can't find anything - no worries

This revision is now accepted and ready to land.May 13 2023, 4:26 AM
goldstein.w.n marked an inline comment as done.May 13 2023, 10:52 AM
goldstein.w.n marked an inline comment as done.
This revision was landed with ongoing or failed builds.May 23 2023, 11:57 AM
This revision was automatically updated to reflect the committed changes.