Skip to content

Fast Register Allocator does not update liveness. #168201

@hiraditya

Description

@hiraditya

Repro
$ ./bin/llc -mtriple=riscv64 -O0 -mtriple=riscv64 -mattr=+m -verify-machineinstrs ../llvm/test/CodeGen/RISCV/constpool-known-bits.ll -debug -print-after-all

# *** IR Dump After Verify generated machine code (machineverifier) ***:
# Machine code for function test: NoPHIs, TracksLiveness, TiedOpsRewritten
Constant Pool:
  cp#0: -9191740941672628224, align=8
  cp#1: -9191740941672640512, align=8
Function Live Ins: $x10 in %0, $x11 in %1

bb.0.entry:
  liveins: $x10, $x11
  %1:gpr = COPY killed $x11
  %0:gpr = COPY killed $x10
  %3:gpr = COPY %1:gpr
  %2:gpr = COPY %0:gpr
  %4:gpr = SLLI %0:gpr, 32
  %5:gpr = SRLI killed %4:gpr, 32
  %6:gpr = LUI target-flags(riscv-hi) %const.0
  %7:gpr = LD killed %6:gpr, target-flags(riscv-lo) %const.0 :: (load (s64) from constant-pool)
  %8:gpr = MUL %5:gpr, killed %7:gpr
  %9:gpr = ADDI killed %8:gpr, 127
  %10:gpr = MUL %5:gpr, killed %9:gpr
  %11:gpr = LUI target-flags(riscv-hi) %const.1
  %12:gpr = LD killed %11:gpr, target-flags(riscv-lo) %const.1 :: (load (s64) from constant-pool)
  %13:gpr = MUL killed %10:gpr, killed %12:gpr
  %14:gpr = ADD killed %13:gpr, %5:gpr
  %15:gpr = LUI 1015920
  %16:gpr = ADDI killed %15:gpr, 1541
  %17:gpr = SLLI killed %16:gpr, 16
  %18:gpr = ADDI killed %17:gpr, 1027
  %19:gpr = SLLI killed %18:gpr, 20
  %20:gpr = ADD killed %14:gpr, killed %19:gpr
  $x10 = COPY %20:gpr
  PseudoRET implicit killed $x10

# End machine code for function test.

********** FAST REGISTER ALLOCATION **********

%1:gpr = COPY killed $x11
Regs: X10_H[P] X11_H=%1
In def of %1 use existing assignment to $x11
Freeing $x11: %1
<< renamable $x11 = COPY killed $x11

# *** IR Dump After Fast Register Allocator (regallocfast) ***:
# Machine code for function test: NoPHIs, TracksLiveness, NoVRegs, TiedOpsRewritten
Constant Pool:
  cp#0: -9191740941672628224, align=8
  cp#1: -9191740941672640512, align=8
Function Live Ins: $x10, $x11

bb.0.entry:
  liveins: $x10, $x11
  dead renamable $x11 = COPY renamable $x10
  renamable $x10 = SLLI killed renamable $x10, 32
  renamable $x11 = SRLI killed renamable $x10, 32
  renamable $x10 = LUI target-flags(riscv-hi) %const.0
  renamable $x10 = LD killed renamable $x10, target-flags(riscv-lo) %const.0 :: (load (s64) from constant-pool)
  renamable $x10 = MUL renamable $x11, killed renamable $x10
  renamable $x10 = ADDI killed renamable $x10, 127
  renamable $x10 = MUL renamable $x11, killed renamable $x10
  renamable $x12 = LUI target-flags(riscv-hi) %const.1
  renamable $x12 = LD killed renamable $x12, target-flags(riscv-lo) %const.1 :: (load (s64) from constant-pool)
  renamable $x10 = MUL killed renamable $x10, killed renamable $x12
  renamable $x10 = ADD killed renamable $x10, killed renamable $x11
  renamable $x11 = LUI 1015920
  renamable $x11 = ADDI killed renamable $x11, 1541
  renamable $x11 = SLLI killed renamable $x11, 16
  renamable $x11 = ADDI killed renamable $x11, 1027
  renamable $x11 = SLLI killed renamable $x11, 20
  renamable $x10 = ADD killed renamable $x10, killed renamable $x11
  PseudoRET implicit killed $x10

# End machine code for function test.

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