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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 22 08:37:54 PST 2025


================
@@ -312,6 +312,55 @@ bool X86InstructionSelector::selectCopy(MachineInstr &I,
       }
     }
 
+    const int RegBankSize = 16;
+
+    // Special case GPR16 -> XMM
+    if (SrcSize == RegBankSize && SrcRegBank.getID() == X86::GPRRegBankID &&
----------------
RKSimon wrote:

TBH I'd prefer we ditch RegBankSize and just put 16 in the condition directly - especially as RegBankSize doesn't hint at the size at all.
```suggestion
    if (SrcSize == 16 && SrcRegBank.getID() == X86::GPRRegBankID &&
```

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


More information about the llvm-commits mailing list