| Issue |
166398
|
| Summary |
[AArch64][GISel] ADD/SUBS "Illegal virtual register for instruction"
|
| Labels |
backend:AArch64,
crash-on-valid
|
| Assignees |
|
| Reporter |
sjoerdmeijer
|
This verifier assert:
```
*** Bad machine code: Illegal virtual register for instruction ***
- function: _Z4testayabjbxxhtahbhhiPxPA24_yPbPaPyS3_S2_PtPhPA25_yS6_PA25_S7_PA25_A25_bS5_SD_PA25_A25_xS6_PSB_SG_SD_
- basic block: %bb.4 for.body34.us.preheader (0x33f574e0)
- instruction: %71:gpr64 = SUBSXrr %1:gpr64, %12:gpr64sp, implicit-def $nzcv
- operand 2: %12:gpr64sp
Expected a GPR64 register, but got a GPR64sp register
```
can be triggered with global isel and `llc -global-isel --verify-machineinstrs`:
```
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "aarch64-unknown-linux-gnu"
define i1 @_Z4testayabjbxxhtahbhhiPxPA24_yPbPaPyS3_S2_PtPhPA25_yS6_PA25_S7_PA25_A25_bS5_SD_PA25_A25_xS6_PSB_SG_SD_(i1 %var_3, i64 %var_6, ptr %var_17, i1 %cmp1111012) {
entry:
br i1 %var_3, label %for.body34.lr.ph, label %for.cond.cleanup33
for.body34.lr.ph: ; preds = %entry
%tobool94.not = icmp eq i8 0, 0
br i1 %tobool94.not, label %for.body34.us.preheader, label %for.body34
common.ret1: ; preds = %for.inc587.us, %for.cond.cleanup33
%common.ret1.op = phi i1 [ false, %for.inc587.us ], [ false, %for.cond.cleanup33 ]
ret i1 %common.ret1.op
for.body34.us.preheader: ; preds = %for.body34.lr.ph
%cmp63.us = icmp ugt i64 %var_6, 3386829365
ret i1 %cmp63.us
for.cond.cleanup33: ; preds = %for.body34, %entry
br i1 %cmp1111012, label %for.body113.lr.ph, label %common.ret1
for.body113.lr.ph: ; preds = %for.cond.cleanup33
%cmp297 = icmp slt i64 0, 3386829379
%storedv304 = zext i1 %cmp297 to i8
br label %for.body119.us
for.body119.us: ; preds = %for.inc587.us, %for.body113.lr.ph
br i1 %cmp1111012, label %for.inc587.us, label %if.then135.us
if.then135.us: ; preds = %for.body119.us
store i8 %storedv304, ptr %var_17, align 1
br label %for.body336.us
for.body336.us: ; preds = %for.body336.us, %if.then135.us
br label %for.body336.us
for.inc587.us: ; preds = %for.body119.us
br i1 %var_3, label %for.body119.us, label %common.ret1
for.body34: ; preds = %for.body34.lr.ph
%cmp63 = icmp ugt i64 1, 3386829365
%storedv76 = zext i1 %cmp63 to i8
store i8 %storedv76, ptr %var_17, align 1
br label %for.cond.cleanup33
; uselistorder directives
uselistorder i1 %var_3, { 1, 0 }
uselistorder ptr %var_17, { 1, 0 }
uselistorder i1 %cmp1111012, { 1, 0 }
}
```
This is probably not a minimal reproducer, but is what llvm-reduce came up with.
See also:
https://godbolt.org/z/Mn8Gcq77a
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs