This is an archive of the discontinued LLVM Phabricator instance.

[Loads] Fix crash in is isDereferenceableAndAlignedPointer()
ClosedPublic

Authored by • tstellarAMD on Sep 20 2016, 11:37 AM.

Details

Summary

We were trying to add APInt values with different bit sizes after
visiting an addrspacecast instruction which changed the bit width
of the pointer.

Diff Detail

Event Timeline

• tstellarAMD retitled this revision from to [Loads] Fix crash in is isDereferenceableAndAlignedPointer().
• tstellarAMD updated this object.
• tstellarAMD added a reviewer: majnemer.
• tstellarAMD added a subscriber: llvm-commits.
hfinkel accepted this revision.Oct 18 2016, 5:48 AM
hfinkel added a reviewer: hfinkel.
hfinkel added a subscriber: hfinkel.
hfinkel added inline comments.
lib/Analysis/Loads.cpp
97

I realize that we don't support object sizes > 2^64, but this seems a bit odd because you're sign extending by converting to a uint64_t unnecessarily. I'd rather you write:

Offset + Size.sextOrTrunc(Offset.getBitWidth())

Otherwise, this LGTM.

This revision is now accepted and ready to land.Oct 18 2016, 5:48 AM
This revision was automatically updated to reflect the committed changes.