Skip to content

*** Bad machine code: Illegal virtual register for instruction *** after early-tailduplication #62712

@mikaelholmen

Description

@mikaelholmen

LLVM commit: c5dede8
Reproduce with:

llc -verify-machineinstrs -mtriple aarch64-none-linux-gnu -o - bbi-63545-aarch64.mir -run-pass early-tailduplication

Result:

# After Early Tail Duplication
# Machine code for function f: IsSSA, TracksLiveness

bb.0:
  successors: %bb.4(0x80000000); %bb.4(100.00%)

  $x0 = COPY undef $x0, implicit-def %0:gpr32common
  B %bb.4

bb.1:
  successors: %bb.4(0x80000000); %bb.4(100.00%)

  $x0 = COPY undef $x0, implicit-def %1:gpr32common
  B %bb.4

bb.3:

bb.4:
; predecessors: %bb.0, %bb.1
  successors: %bb.5(0x50000000), %bb.6(0x30000000); %bb.5(62.50%), %bb.6(37.50%)

  %3:gpr32sp = PHI %0:gpr32common, %bb.0, %1:gpr32common, %bb.1
  CBNZW %3:gpr32sp, %bb.6

bb.5:
; predecessors: %bb.4


bb.6:
; predecessors: %bb.4


# End machine code for function f.

*** Bad machine code: Illegal virtual register for instruction ***
- function:    f
- basic block: %bb.4  (0x9140f00)
- instruction: CBNZW %3:gpr32sp, %bb.6
- operand 0:   %3:gpr32sp
Expected a GPR32 register, but got a GPR32sp register
LLVM ERROR: Found 1 machine code errors.

So early tail-duplication has changed
CBNZW %1, %bb.6
where %1 is a gpr32 vreg into
CBNZW %3:gpr32sp, %bb.6
but CBNZW requires a vreg of the class gpr32.

bbi-63545-aarch64.mir.gz

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions