[PATCH] D80072: Make Value::getPointerAlignment() return an Align, not a MaybeAlign.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 16 21:12:29 PDT 2020


jdoerfert added a comment.

Everything except the Loads.cpp stuff LGTM.



================
Comment at: llvm/lib/Analysis/Loads.cpp:40
+      BA = DL.getABITypeAlign(Ty);
   }
+  const APInt APAlign(Offset.getBitWidth(), Alignment.value());
----------------
As you noted, this seems wrong. I think this allows wrong results for `llvm::isDereferenceableAndAlignedPointer` queries. What happens if you remove this boosting? 

--- 

>From D9791: 
> I assume that pointers without explicit alignment have ABI alignment.

I think this is OK for pointers accessed by loads without specified alignment but not for "pointers" in the general sense. If you look at the AttributorAttributes.cpp change, the function there does something similar to the `getBaseAlign` on the left but it only does so for pointers accessed without specified alignment. (= I think I came to this conclusion for the second time.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80072/new/

https://reviews.llvm.org/D80072





More information about the llvm-commits mailing list