[PATCH] D137778: [GlobalISel] Correct constant type in matchReassocConstantInnerLHS
chenglin.bi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 10 20:07:14 PST 2022
bcl5980 added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4552-4561
LHSPtrAdd->moveBefore(&MI);
Register RHSReg = MI.getOffsetReg();
Observer.changingInstr(MI);
- MI.getOperand(2).setReg(LHSCstOff->VReg);
+ // set VReg will cause type mismatch if it comes from extend/trunc
+ auto NewCst = B.buildConstant(MRI.getType(RHSReg), LHSCstOff->Value);
+ MI.getOperand(2).setReg(NewCst.getReg(0));
Observer.changedInstr(MI);
----------------
arsenm wrote:
> If you're going to potentially create a new constant anyway, can you just create the constant and get rid of all this moveBefore stuff?
It looks we can't remove the `moveBefore`. Test failed on `CodeGen/AMDGPU/GlobalISel/mubuf-global.ll`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137778/new/
https://reviews.llvm.org/D137778
More information about the llvm-commits
mailing list