[llvm] [LAA]Fix implicit trunc from int64 to int and losing info (PR #139553)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon May 12 11:39:42 PDT 2025
================
@@ -1585,6 +1585,8 @@ std::optional<int> llvm::getPointersDiff(Type *ElemTyA, Value *PtrA,
OffsetB = OffsetB.sextOrTrunc(IdxWidth);
OffsetB -= OffsetA;
+ if (OffsetB.getSignificantBits() > sizeof(int) * 8)
----------------
alexey-bataev wrote:
Probably, this function just calculates the distance between 2 pointers, most probably we can reuse APInt for comparison and sorting. But it will require adjusting all users to handle APInt instead of optional<int>
https://github.com/llvm/llvm-project/pull/139553
More information about the llvm-commits
mailing list