[llvm] CallPromotionUtils: Correctly use IndexSize when determining the bit width of pointer offsets. (PR #119138)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 9 12:15:39 PST 2024
================
@@ -692,14 +692,17 @@ bool llvm::tryPromoteCall(CallBase &CB) {
if (!VTableEntryLoad)
return false; // Not a vtable entry load.
Value *VTableEntryPtr = VTableEntryLoad->getPointerOperand();
- APInt VTableOffset(DL.getTypeSizeInBits(VTableEntryPtr->getType()), 0);
+ APInt VTableOffset(DL.getIndexSizeInBits(
+ VTableEntryPtr->getType()->getPointerAddressSpace()),
+ 0);
----------------
nikic wrote:
You can use `getIndexTypeSizeInBits()` to make this more compact.
https://github.com/llvm/llvm-project/pull/119138
More information about the llvm-commits
mailing list