[llvm] [Loads] Also consider getPointerAlignment when checking assumptions. (PR #120916)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 8 08:04:43 PST 2025
================
@@ -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);
----------------
nikic wrote:
FWIW I just dropped the offset argument in https://github.com/llvm/llvm-project/commit/a5c3cbf7e0df23ca898e4f65e78531641fe4bf60. Though TBH it may make more sense to inline the function.
https://github.com/llvm/llvm-project/pull/120916
More information about the llvm-commits
mailing list