Skip to content

Commit 9b6bb83

Browse files
committed
Revert "CallPromotionUtils: Correctly use IndexSize when determining the bit width of pointer offsets. (#119138)"
Reverting due to ASAN bootstrap failures. This reverts commit 4027e2f.
1 parent 609899f commit 9b6bb83

File tree

2 files changed

+3
-51
lines changed

2 files changed

+3
-51
lines changed

llvm/lib/Transforms/Utils/CallPromotionUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -692,14 +692,14 @@ bool llvm::tryPromoteCall(CallBase &CB) {
692692
if (!VTableEntryLoad)
693693
return false; // Not a vtable entry load.
694694
Value *VTableEntryPtr = VTableEntryLoad->getPointerOperand();
695-
APInt VTableOffset(DL.getIndexTypeSizeInBits(VTableEntryPtr->getType()), 0);
695+
APInt VTableOffset(DL.getTypeSizeInBits(VTableEntryPtr->getType()), 0);
696696
Value *VTableBasePtr = VTableEntryPtr->stripAndAccumulateConstantOffsets(
697697
DL, VTableOffset, /* AllowNonInbounds */ true);
698698
LoadInst *VTablePtrLoad = dyn_cast<LoadInst>(VTableBasePtr);
699699
if (!VTablePtrLoad)
700700
return false; // Not a vtable load.
701701
Value *Object = VTablePtrLoad->getPointerOperand();
702-
APInt ObjectOffset(DL.getIndexTypeSizeInBits(Object->getType()), 0);
702+
APInt ObjectOffset(DL.getTypeSizeInBits(Object->getType()), 0);
703703
Value *ObjectBase = Object->stripAndAccumulateConstantOffsets(
704704
DL, ObjectOffset, /* AllowNonInbounds */ true);
705705
if (!(isa<AllocaInst>(ObjectBase) && ObjectOffset == 0))
@@ -712,7 +712,7 @@ bool llvm::tryPromoteCall(CallBase &CB) {
712712
VTablePtrLoad, VTablePtrLoad->getParent(), BBI, 0, nullptr, nullptr);
713713
if (!VTablePtr)
714714
return false; // No vtable found.
715-
APInt VTableOffsetGVBase(DL.getIndexTypeSizeInBits(VTablePtr->getType()), 0);
715+
APInt VTableOffsetGVBase(DL.getTypeSizeInBits(VTablePtr->getType()), 0);
716716
Value *VTableGVBase = VTablePtr->stripAndAccumulateConstantOffsets(
717717
DL, VTableOffsetGVBase, /* AllowNonInbounds */ true);
718718
GlobalVariable *GV = dyn_cast<GlobalVariable>(VTableGVBase);

llvm/test/Transforms/Inline/promote-call-bitwidth.ll

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)