[PATCH] D147260: [Loads] Support SCEVAddExpr as start for pointer AddRec.
    Florian Hahn via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Mar 31 13:54:46 PDT 2023
    
    
  
fhahn added inline comments.
================
Comment at: llvm/lib/Analysis/Loads.cpp:320
+      if (Overflow)
+        return false;
+    }
----------------
nikic wrote:
> Don't you need to check that Offset is also aligned? If I'm reading this right, you'd currently accept Offset = 1 for Alignment = 4, as it is only checked against EltSize and the base pointer.
Thanks I was assuming the total size was also checked in `isDereferenceableAndAlignedPointer` but that's not the case!
I added test cases for both the check of EltSize (looks like this was missing) and the check for the offset in 74dee4791a2b3f17a49ea2f90ce3730f241f36ac and 3b95c335887df73123991d023dadb36cd914fc91
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147260/new/
https://reviews.llvm.org/D147260
    
    
More information about the llvm-commits
mailing list