[llvm] [Loads] Also use isAligned when checking assumptions. (PR #120916)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 20:28:40 PST 2024


================
@@ -173,9 +173,11 @@ static bool isDereferenceableAndAlignedPointer(
 
   if (CtxI) {
     /// Look through assumes to see if both dereferencability and alignment can
-    /// be provent by an assume
+    /// be provent by an assume if needed.
     RetainedKnowledge AlignRK;
     RetainedKnowledge DerefRK;
+    APInt Offset(DL.getTypeStoreSizeInBits(V->getType()), 0);
+    bool IsAligned = isAligned(V, Offset, Alignment, DL);
----------------
arsenm wrote:

Can you just use getPointerAlignment directly? isAligned is just making you use this temporary 0 offset 

https://github.com/llvm/llvm-project/pull/120916


More information about the llvm-commits mailing list