From dc141af7553871b94f0d7cb4b1f2096578a923be Mon Sep 17 00:00:00 2001 From: Dominik Montada Date: Thu, 30 Jan 2020 08:25:10 -0500 Subject: [PATCH] [GlobalISel] (fix) Use pointer type size for offset constant when lowering stores Commit 9965b12fd1b was supposed to change the offset constant when lowering load/stores, but only introduced this change for loads. This patch adds the same fix for stores. --- llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp index 5eb87c2..1bdd8eb 100644 --- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp @@ -2346,8 +2346,8 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT Ty) { // Generate the PtrAdd and truncating stores. LLT PtrTy = MRI.getType(PtrReg); - auto OffsetCst = - MIRBuilder.buildConstant(LLT::scalar(64), LargeSplitSize / 8); + auto OffsetCst = MIRBuilder.buildConstant( + LLT::scalar(PtrTy.getSizeInBits()), LargeSplitSize / 8); Register PtrAddReg = MRI.createGenericVirtualRegister(PtrTy); auto SmallPtr = MIRBuilder.buildPtrAdd(PtrAddReg, PtrReg, OffsetCst.getReg(0)); -- 2.7.4