<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55204>55204</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
ICE... SystemZISel? LICM load hoisting?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
uweigand,
djtodoro
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JonPsson
</td>
</tr>
</table>
<pre>
I got a test case that resulted in
`fatal error: error in backend: Cannot select: t61: i64 = Constant<8237692794279528316>`
I did a bisect and found that the first bad commit was 2cdc6f2ca62e "Reland "[LICM] Hoist LOAD without sinking the STORE"". I find that it helps to revert that commit on HEAD as well...
I see in the reduced test case:
```
%and = and i64 %and12, %conv3 | %2 = load i64, ptr @e, align 8, !tb
> %and = and i64 %2, %conv3
store i64 %and, ptr @e, align 8, !t store i64 %and, ptr @e, align 8, !t
```
This is inside a loop and it's not for me trivial to see that the hoisting of the load of @e is safe...
In SystemZ isel, it seems that we get an 'and' with two constants, which we can't quite handle.
i64 = and Constant:i64<1064831134304125>, OpaqueConstant:i64<1064831134304126>
tryRISBGZero(Node) is called, which calls SelectCode(N) which then fails. N is then a 'i64 = Constant<1064831134304124>'
Not sure if SystemZISel should be able to handle this type of node or if something earlier has just gone wrong...
[testcase.tar.gz](https://github.com/llvm/llvm-project/files/8597333/testcase.tar.gz)
```
clang -march=z13 -O1 crash0.i -o a.out -w
clang -march=z13 -O2 crash0.i -o a.out -w
fatal error: error in backend: Cannot select: t48: i64 = Constant<1064831134304124>
llc -O2 -o out.s crash0.ll
LLVM ERROR: Cannot select: t48: i64 = Constant<1064831134304124>
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVUtv2zgQ_jXyZRBBomzLPviQOsnWizRZOEUPvVHUSGJKiy5JxUh__c5QTuIE2Xa7WEOW-JqZb14fK1s_rjbQ2gASAvoASnqE0MkADv1gAtag-yS7SLLz43ueNT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