This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Fix crash in GetPointerBaseWithConstantOffset()
ClosedPublic

Authored by tstellarAMD on Sep 20 2016, 10:53 AM.

Details

Summary

While walking defs of pointer operands we were assuming that the pointer
size would remain constant. This is not true, because addresspacecast
instructions may cast the pointer to an address space with a different
pointer width.

Diff Detail

Repository
rL LLVM

Event Timeline

tstellarAMD retitled this revision from to [ValueTracking] Fix crash in GetPointerBaseWithConstantOffset().
tstellarAMD updated this object.
tstellarAMD added reviewers: sanjoy, reames.
tstellarAMD added a subscriber: llvm-commits.
sanjoy accepted this revision.Sep 26 2016, 12:21 PM
sanjoy edited edge metadata.

lgtm

Btw, this looks like a good reason to change accumulateConstantOffset to return an Optional<APInt> of the right bitwidth.

This revision is now accepted and ready to land.Sep 26 2016, 12:21 PM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/Analysis/ValueTracking/get-pointer-base-with-const-off.ll