Use pointer type size for offset constant when lowering load/stores
authorDominik Montada <dominik.montada@gmail.com>
Mon, 27 Jan 2020 14:35:59 +0000 (09:35 -0500)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Mon, 27 Jan 2020 14:55:32 +0000 (06:55 -0800)
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp

index a6fe2c3..8245fa1 100644 (file)
@@ -2273,8 +2273,8 @@ LegalizerHelper::lower(MachineInstr &MI, unsigned TypeIdx, LLT Ty) {
         auto LargeLoad =
             MIRBuilder.buildLoad(LargeLdReg, PtrReg, *LargeMMO);
 
-        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));