<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/150875>150875</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[GlobalIsel] Assertion when generating code for ptrtoint with vector operands
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:globalisel
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
arichardson
</td>
</tr>
</table>
<pre>
The following IR when run with `llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs`
```llvm
define <2 x i64> @ptrtoint_vec(<2 x ptr> %p) {
entry:
%addr = ptrtoint <2 x ptr> %p to <2 x i64>
%ret = xor <2 x i64> %addr, <i64 -1, i64 -1>
ret <2 x i64> %ret
}
```
triggers the following assertion:
> llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp:1428: virtual MachineInstrBuilder llvm::MachineIRBuilder::buildInstr(unsigned int, ArrayRef<DstOp>, ArrayRef<SrcOp>, std::optional<unsigned int>): Assertion `(TypeSize::ScalarTy)SrcOps.size() * SrcOps[0].getLLTTy(*getMRI()).getSizeInBits() == DstOps[0].getLLTTy(*getMRI()).getSizeInBits() && "input scalars do not exactly cover the output vector register"' failed.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVMGO4jgQ_ZrKxQIZOwnJIYcAywhpRit1933kxEXwym1HdoWG_fqVE9iZ7j2uhFDiqvdS9fyqVIxmcIgNFDsoDpma6OJDo4LpLyro6F3WeX1v3i7Izt5a_2HcwE4v7OOCjoXJsQ9DFwYlt7Znq3cKZrQI8nCryp9lvrLGTbfV4Ca2GqzvlF2ZiJatrhjM-b56V_3FODQuUohQcuBt-p9_1l7fgbcaz8YhA7kX7MZMmYP8g0HORwrkjaOfV-xBVI_4SGGOi2IEUTPY7oC36CjcQbbAW5ZCSuvAQB7Yk4P9F83If_7mExyQZuzNh69FLcwg9ilgypytNunl8fSgWPBfcAEptb49_C5AeuYtBTMMGCKjT1egYsRAxrulr8QzCyaO1nQgjnuv8Rs6EMdvs-6nV7Qgjj8WwU8vu8lYjWHdjyPIdpMnBVt2NYEmZdkzLd3LI3Ohly3I9ivJctqllxkBoprc7CvNjKOkQRuCur_gGeT-EOnPManx-fg19P8eR9ILpx9Ti8qC3H9iTGl1Krh9ypAsCKJ6u4_4av7GBf7aK6vC2x1EPdPHdUwxUc3eEC1bTqHYcSgO6wHp-_e3lF6BaAekHy-nJRlEnaKJ-eR2huKTQx6SF-aW_g-NKEGUDIQwbpyIxbnuyLRnzhPDm-rJ3lnvrxhmH_iJUt4Ve_KBBRxMJAwgBIgtOytjUa-Bt5lupK5lrTJsNttCltsqz2V2aapOS9Q99gXm-lxjvTlz3JSyP2-14NhlphFcFHwrKp4XOZdruUHscZv3qhY17zjkHN-Vsetki7UPQ2ZinLDZFLzaFplVHdo4bxUhHs5ZFkCa_1RocchCkyKrbhoi5NyaSPEXHRmy81p6-DfBisNvFz5voAEdBkVpInqv04CEX1M9r6aHRn7EoJyO2RRscyEaY7KIOII4DoYuU7fu_Tw9jyFKhY3B_4U9gTjOvUUQx0d710b8EwAA__8g7KCa">