[llvm] CallPromotionUtils: Correctly use IndexSize when determining the bit width of pointer offsets. (PR #119138)

Owen Anderson via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 15:16:16 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);
----------------
resistor wrote:

Done.

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


More information about the llvm-commits mailing list