<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64431>64431</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64][GlobalISel] Crash when selecting G_CONSTANT_FOLD_BARRIER
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64,
globalisel
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davemgreen
</td>
</tr>
</table>
<pre>
The register classes into and out of a G_CONSTANT_FOLD_BARRIER are different in this example, causing an assert when selecting the instruction:
https://godbolt.org/z/G8443GYjx
```
; ModuleID = 'reduced.bc'
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"
define fastcc i1 @_ZL15gimple_simplifyP15gimple_match_opPP6gimplePFP9tree_nodeS5_E11code_helperS5_S5_S5_S5_(i1 %cond, i1 %cond1) {
entry:
br i1 %cond, label %sw.bb9, label %sw.bb34
sw.bb9: ; preds = %entry
br i1 %cond1, label %sw.bb72.i, label %sw.bb5.i
sw.bb5.i: ; preds = %sw.bb9
br i1 %cond, label %common.ret, label %land.rhs.i
land.rhs.i: ; preds = %sw.bb5.i
%call45.i = tail call i32 (ptr, ptr, ...) @fprintf(ptr null, ptr null, ptr null, i32 1, ptr null, i32 145185)
br label %common.ret
common.ret: ; preds = %sw.bb34, %sw.bb72.i, %land.rhs.i, %sw.bb5.i
ret i1 false
sw.bb72.i: ; preds = %sw.bb9
%call105.i = tail call i32 (ptr, ptr, ...) @fprintf(ptr null, ptr null, ptr null, i32 0, ptr null, i32 145213)
br label %common.ret
sw.bb34: ; preds = %entry
%call133.i = tail call i32 (ptr, ptr, ...) @fprintf(ptr null, ptr null, ptr null, i32 0, ptr null, i32 146354)
br label %common.ret
}
declare i32 @fprintf(ptr, ptr, ...)
```
@aemerson any ideas?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.ll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