Issue 52817
Summary Machine verification error after PostRA list scheduler
Labels new issue
Assignees
Reporter nikic
    The test case at https://gist.github.com/nikic/0b5ff77ab7248466eb525d934e98bbeb when run through `llc -verify-machineinstrs` results in a verifier error:

```
*** Bad machine code: Using an undefined physical register ***
- function:    wombat
- basic block: %bb.1 bb3 (0x749dca8)
- instruction: BUNDLE implicit-def dead $itstate, implicit-def $r6, implicit killed $cpsr, implicit $r0, implicit killed $r5, implicit $r8, debug-location !341; compiler-rt/lib/sanitizer_common/sanitizer_bitvector.h:0 @[ compiler-rt/lib/sanitizer_common/sanitizer_bitvector.h:204:23 @[ compiler-rt/lib/sanitizer_common/sanitizer_bitvector.h:251:5 @[ compiler-rt/lib/sanitizer_common/sanitizer_bvgraph.h:52:8 ] ] ]
- operand 4:   implicit killed $r5
```

>From what I can tell, the issue is related to kill flag fixup in post-RA list scheduling done in https://github.com/llvm/llvm-project/blob/c2f2bb066b83551db3f9c32d04d6b80ac9a49a6d/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp#L1139-L1153. For the bundle itself, toggleKills is called with addToLiveRegs=false, and the only use in the bundle is a debug instruction which is skipped, so the end result is that the register is not marked as live and the bundle ends up using a killed register.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to