Skip to content

[AArch64][GISel] COPY "Register class GPR32all does not support subreg index sub_32" #166541

@sjoerdmeijer

Description

@sjoerdmeijer

This IR:

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 i8 @_Z1ev(i1 %cmp724, ptr %a) {
entry:
  br i1 %cmp724, label %for.cond5.for.cond.cleanup8_crit_edge, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %entry
  %min.iters.check46 = icmp ult i32 0, 0
  %.not109 = and i1 %cmp724, true
  %rdx.select61 = select i1 %.not109, i8 1, i8 0
  br label %for.cond5.for.cond.cleanup8_crit_edge

for.cond5.for.cond.cleanup8_crit_edge:            ; preds = %vector.main.loop.iter.check, %entry
  %conv12.lcssa = phi i8 [ %rdx.select61, %vector.main.loop.iter.check ], [ 0, %entry ]
  %0 = freeze i8 %conv12.lcssa
  store i8 %0, ptr %a, align 1
  ret i8 0
}

Triggers this verifier failure:

*** Bad machine code: Invalid subregister index for virtual register ***
- function:    _Z1ev
- basic block: %bb.3 for.cond5.for.cond.cleanup8_crit_edge (0x12f49e40)
- instruction: %20:gpr32 = COPY %19.sub_32:gpr32all
- operand 1:   %19.sub_32:gpr32all
Register class GPR32all does not support subreg index sub_32

when compiled with --verify-machineinstrs -global-isel, see also:

https://godbolt.org/z/vK3sr9xvd

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions