This is an archive of the discontinued LLVM Phabricator instance.

[APInt] Fix extractBits to correctly handle Result.isSingleWord() case.
ClosedPublic

Authored by timshen on Feb 15 2018, 5:04 PM.

Details

Summary

extractBits assumes that !this->isSingleWord() implies !Result.isSingleWord(), which may not necessarily be true. Handle both cases.

Diff Detail

Repository
rL LLVM

Event Timeline

timshen created this revision.Feb 15 2018, 5:04 PM

I don't know the code well enough here to just say yes or no, I'd be fine with you doing post commit review here since this is reasonably well tested and nothing else has broken.

This revision was not accepted when it landed; it landed in state Needs Review.Feb 15 2018, 5:46 PM
This revision was automatically updated to reflect the committed changes.
timshen reopened this revision.Feb 15 2018, 5:47 PM

Landed. Reopen for post-commit review.

craig.topper added inline comments.Feb 15 2018, 6:00 PM
llvm/trunk/lib/Support/APInt.cpp
436

Alternatively this could be

getRawData()[word] =....

but I don't care much.
timshen added inline comments.Feb 15 2018, 6:06 PM
llvm/trunk/lib/Support/APInt.cpp
436

Unfortunately getRawData() returns a const pointer. :P

RKSimon accepted this revision.Feb 16 2018, 2:58 AM

LGTM, thanks. TBH I don't think its worth adding a non-const version of getRawData()

This revision is now accepted and ready to land.Feb 16 2018, 2:58 AM
timshen closed this revision.Feb 16 2018, 11:59 AM