[NFC] Replace the FIXME I added in rL369989 with a comment clarifying the current code

The current approach is restrictive (as all of geps must be multiples of the alignment), but correct.  

llvm-svn: 370013
This commit is contained in:
Philip Reames 2019-08-27 04:52:35 +00:00
parent 3cecf9747b
commit b9f3665d47

View File

@ -64,9 +64,9 @@ static bool isDereferenceableAndAlignedPointer(
V->getPointerDereferenceableBytes(DL, CheckForNonNull));
if (KnownDerefBytes.getBoolValue() && KnownDerefBytes.uge(Size))
if (!CheckForNonNull || isKnownNonZero(V, DL, 0, nullptr, CtxI, DT)) {
// FIXME: We need to pass through original size/offset when we recurse,
// the result here is wrong for cases such as a 4 byte load, 2 bytes
// off a 8 byte aligned base.
// As we recursed through GEPs to get here, we've incrementally checked
// that each step advanced by a multiple of the alignment. If our base is
// properly aligned, then the original offset accessed must also be.
Type *Ty = V->getType();
assert(Ty->isSized() && "must be sized");
APInt Offset(DL.getTypeStoreSizeInBits(Ty), 0);