[llvm] dc141af - [GlobalISel] (fix) Use pointer type size for offset constant when lowering stores
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 05:32:43 PST 2020
Author: Dominik Montada
Date: 2020-01-30T08:32:35-05:00
New Revision: dc141af7553871b94f0d7cb4b1f2096578a923be
URL: https://github.com/llvm/llvm-project/commit/dc141af7553871b94f0d7cb4b1f2096578a923be
DIFF: https://github.com/llvm/llvm-project/commit/dc141af7553871b94f0d7cb4b1f2096578a923be.diff
LOG: [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.
Added:
Modified:
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 5eb87c2a8f14..1bdd8eb81e2a 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));
More information about the llvm-commits
mailing list