[llvm] [InferAlignment] Fix updating alignment when larger than i32 (PR #160109)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 22 07:14:36 PDT 2025


================
@@ -57,7 +57,8 @@ static bool tryToImproveAlign(
         cast<ConstantInt>(II->getArgOperand(AlignOpIdx))->getAlignValue();
     Align PrefAlign = DL.getPrefTypeAlign(Type);
     Align NewAlign = Fn(PtrOp, OldAlign, PrefAlign);
-    if (NewAlign <= OldAlign)
+    if (NewAlign <= OldAlign ||
+        NewAlign.value() > std::numeric_limits<uint32_t>().max())
----------------
nikic wrote:

@arsenm We already use MaxAlignmentExponent -- the problem is that these specific intrinsics don't support the full alignment range (the maximum exponent is one less).

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


More information about the llvm-commits mailing list