Skip to content

Commit 214f67e

Browse files
committed
GlobalISel: Check address space when looking up iPTR size
Fixes AMDGPU patterns for 32-bit address spaces always failing. Tests will be included in future patches when additional issues are solved. llvm-svn: 365319
1 parent 1159fe3 commit 214f67e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -478,17 +478,19 @@ bool InstructionSelector::executeMatchTable(
478478
<< InsnID << "]->getOperand(" << OpIdx
479479
<< "), SizeInBits=" << SizeInBits << ")\n");
480480
assert(State.MIs[InsnID] != nullptr && "Used insn before defined");
481+
MachineOperand &MO = State.MIs[InsnID]->getOperand(OpIdx);
482+
const LLT Ty = MRI.getType(MO.getReg());
483+
481484
// iPTR must be looked up in the target.
482485
if (SizeInBits == 0) {
483486
MachineFunction *MF = State.MIs[InsnID]->getParent()->getParent();
484-
SizeInBits = MF->getDataLayout().getPointerSizeInBits(0);
487+
const unsigned AddrSpace = Ty.getAddressSpace();
488+
SizeInBits = MF->getDataLayout().getPointerSizeInBits(AddrSpace);
485489
}
486490

487491
assert(SizeInBits != 0 && "Pointer size must be known");
488492

489-
MachineOperand &MO = State.MIs[InsnID]->getOperand(OpIdx);
490493
if (MO.isReg()) {
491-
const LLT &Ty = MRI.getType(MO.getReg());
492494
if (!Ty.isPointer() || Ty.getSizeInBits() != SizeInBits)
493495
if (handleReject() == RejectAndGiveUp)
494496
return false;

0 commit comments

Comments
 (0)