This is an archive of the discontinued LLVM Phabricator instance.

[APSInt] Fix bug in APSInt in issue 59513
AbandonedPublic

Authored by Peter on Dec 20 2022, 10:37 AM.

Details

Reviewers
RKSimon
arphaman
Summary

Also provide a tryExtValue() API like APInt did in D139683
This patch is almost identical to D140059, that one got reverted due a MIParser bug.
MIParser::parseImmediateOperand() expected APSInt.getExtValue to give back a 64bit integer regardless the sign.

getExtValue() used to provide a 64bit representation regardless of the sign.
After this patch, only 63 bits are allowed for unsigned value since the return value is int64_t.
This change of semantics caused some unit testing w/ large constants to fail.

We modify MIParser to refelect the intended behavior using try API introduced in D139683.
It's also a show case how try API can be used conveniently where user don't need to worry about
the detailed conditions.

Diff Detail

Event Timeline

Peter created this revision.Dec 20 2022, 10:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 10:37 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Peter requested review of this revision.Dec 20 2022, 10:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 10:37 AM
Peter edited the summary of this revision. (Show Details)Dec 20 2022, 10:40 AM
Peter added reviewers: RKSimon, arphaman.
RKSimon added a comment.EditedDec 22 2022, 2:55 AM

Why didn't you just reopen D140059? We'd have a better paper trail then.

Peter abandoned this revision.Dec 23 2022, 11:09 AM

Why didn't you just reopen D140059? We'd have a better paper trail then.

I didn't know that's an option. Thanks for pointing out, closing this and move back to D140059 now.