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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 21:52:35 PDT 2019


Author: reames
Date: Mon Aug 26 21:52:35 2019
New Revision: 370013

URL: http://llvm.org/viewvc/llvm-project?rev=370013&view=rev
Log:
[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.  


Modified:
    llvm/trunk/lib/Analysis/Loads.cpp

Modified: llvm/trunk/lib/Analysis/Loads.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/Loads.cpp?rev=370013&r1=370012&r2=370013&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/Loads.cpp (original)
+++ llvm/trunk/lib/Analysis/Loads.cpp Mon Aug 26 21:52:35 2019
@@ -64,9 +64,9 @@ static bool isDereferenceableAndAlignedP
                         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);




More information about the llvm-commits mailing list