[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:36:18 PST 2022


bcl5980 marked an inline comment as done.
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:
> bcl5980 wrote:
> > 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`.
> By failed do you mean actually broken, or just needs updating?
Actually broken.



> Use of %10 does not have a corresponding definition on every path:
> 64r %31:vgpr_32, %33:sreg_64_xexec = V_ADD_CO_U32_e64 %3:vgpr_32, %10.sub0:vreg_64, 0, implicit $exec
> LLVM ERROR: Use not jointly dominated by defs.
> PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
> Stack dump:
> 0.      Program arguments: build\\bin\\llc -global-isel -mtriple=amdgcn-mesa-mesa3d -mcpu=tahiti
> 1.      Running pass 'CallGraph Pass Manager' on module '<stdin>'.
> 2.      Running pass 'Live Interval Analysis' on function '@mubuf_store_vgpr_ptr_sgpr_offset256_offset'




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137778/new/

https://reviews.llvm.org/D137778



More information about the llvm-commits mailing list