<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/137249>137249</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Window scheduler ignores IMPLICIT_DEF instructions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Zararest
</td>
</tr>
</table>
<pre>
## Description
I was working with window scheduler and found confusing part in its algorithm.
On the line llvm/lib/CodeGen/WindowScheduler.cpp:300 WindowScheduler copies region to schedule, but ignores meta instructions one of which is IMPLICIT_DEF. Because of this all uses of IMPLICIT_DEF have no definition. This results in assertion later in code.
I created a reproduction for Hexagon, but I am not sure whether this code is correct. Probably, there are other examples where IMPLICIT_DEF and its use are in the same basic block, but I could not find them.
## Reproduction
```
bash ./run.txt
```
[run.txt](https://github.com/user-attachments/files/19899179/run.txt)
[pipeliner-assert.txt](https://github.com/user-attachments/files/19899182/pipeliner-assert.txt)
Debug build fails with assertion.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVF2L4zYU_TXKy2WMothJ_OCHzKRuAy1d2oWFvpRr-dpWV5aMrjSZ_fdFzmR3dih9WjAYdD_OOfcLmc3oiBpRPYrqvMEUJx-avzBgII6bzvdfGqF2Qu3gTKyDWaLxTsjTBa7IcPXhs3EjXE2c4Gpc76_AeqI-WQqArofBJ9eD9m5InD0XDBGMAxMZ0I4-mDjNBQh5-t1BnAiscQTWPs9CtdZ0QrVPvqefyQnVfloR_rwDFHpZxO60kxLeWUD7xRBDoNF4B9F_ZSXUE3QpghmdD8QwU0QwjmNIOktj8I7AD3CdjJ7AMFx--_Dr5eny8e_zT20Bj6Qx8eoRJ5M1WEhMnB_eesKEzwTOQ0-DcSanLuBjjgjEyUbORUBmCtkEFiOF_KR9T4WQp7XEOhBG6gEh0BJ8f6MIgw_wC73g6N1dzgVwBucjcAoE14niROHGMGeE9R8C6VjAh-A77OyXHJvdCDAQ-DWCXnBeLHFOEeh7RbmduW1Zfo4wt4YxzgQdstHQWa8_f6OkfbL9ymowrs_O86u015H6442q_LqXr588dcgTFEK1IbkivsR3ZlE93g3VWajjFOPCYncSqhWqHU2cUldon4coMYUHjBH1NJOLLFQ7GEv5v62Pdb091G9gVP3KsHpczEJ5GsPDrU8_Bu2ohGr_M_Ud-kxdGqFLxvYwoLF8W6-vw1LApm92fb2rcUPN9lBWlaoPUm2mpjyixE7u66GTpLHaD6ou1aC3-31dHQ-4MY2SqpKlKtVWbUtVHGSpD9hvjxr3slRKlJJmNLbIK1j4MG4Mc6Jmuzuost5Y7Mjyei6UcnSF1SqUytcjNDnooUsji1Jaw5G_pYkmWmo-vb8R9z38btLe7uMmBdv8T8HvpyIjL8H_QzoK1a601qLfeD836t8AAAD__xSGowI">