[llvm] [X86][GISel] Fix crash on bitcasting i16 <-> half with gisel enabled. (PR #168456)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 15:56:45 PST 2025


================
@@ -4366,6 +4367,30 @@ void X86InstrInfo::copyPhysReg(MachineBasicBlock &MBB,
   else if (X86::VK16RegClass.contains(DestReg, SrcReg))
     Opc = Subtarget.hasBWI() ? (HasEGPR ? X86::KMOVQkk_EVEX : X86::KMOVQkk)
                              : (HasEGPR ? X86::KMOVQkk_EVEX : X86::KMOVWkk);
+
+  else if (X86::GR16RegClass.contains(DestReg) &&
----------------
GrumpyPigSkin wrote:

Aha okay, thanks I think I get it now. It looks as though `X86InstructionSelector::selectCopy` does not handle the correct and see's half <-> i16 as a valid operation. This looks the correct place to fix this so I will move the implementation there. Does that make sense?

https://github.com/llvm/llvm-project/pull/168456


More information about the llvm-commits mailing list