Issue 124977
Summary [MachineVerifier] Does not report broken livein-list
Labels llvm:codegen
Assignees
Reporter JonPsson1
    A test case emerged that seems to be due to an erroneous kill-flag, in the way that a register as live-in while it was killed in the only predecessor of the block:

```
    renamable $r1l = AHIMuxK killed renamable $r1l, -1, implicit-def dead $cc
    $r14l = COPY killed renamable $r1l
    BRC 14, 6, %bb.3, implicit $cc

  bb.2:
    liveins: $r1l

    $r14l = COPY renamable $r1l
```

Even though this may look harmless, this will actually cause Machine Copy Propagation to produce wrong code:

```
    $r14l = AHIMuxK killed renamable $r1l, -1, implicit-def dead $cc
    CHIMux renamable $r5h, 9, implicit-def $cc
    BRC 14, 6, %bb.2, implicit $cc
  
 bb.1:
    successors: %bb.2(0x80000000)
    liveins: $r1l
  
    $r14l = COPY renamable $r1l
 
```

It seems reasonable that MachineVerifier would have helped to detect this case, but it does not. At least for a block with a single predecessor, I think it should check that the register is live out from it..?

The above in a .mir test case:

[tc_badlivein.tar.gz](https://github.com/user-attachments/files/18593401/tc_badlivein.tar.gz)
llc -mtriple=s390x-linux-gnu -o after-machine-cp.mir -mcpu=z15 -O1 ./tc_badlivein.mir -run-pass=machine-cp -verify-machineinstrs

This is related to #124768 

@guy-david  @topperc @arsenm @michaelmaitland 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to