Open Quincunx271 opened 4 years ago
You could try using LLVM's "-stop-before=machine-scheduler" -o file.mir <file>
and then create a reduced version of the MIR based on that.
There don't seem to be many examples of MIR tests for X86 in LLMV either. I tried to make something to get you started since MIR is really finicky. For example you can only explicitly mark physical registers as livein...
This probably isn't recreating the register classes correctly to repo the bug. You can run the scheduler on this code at least with llc -march=x86-64 -run-pass=machine-scheduler testname.mir -o -
.
---
name: testname
tracksRegLiveness: true
body: |
bb.0:
%0:gr32 = IMPLICIT_DEF
%1:gr64 = IMPLICIT_DEF
%2:gr64_nosp = IMPLICIT_DEF
%3:gr64_nosp = IMPLICIT_DEF
JMP_1 %bb.1
bb.1:
%6:gr32 = COPY %0
%4:gr32 = LEA64_32r %2, 0, %3, 0, $noreg
%5:gr32 = LEA64_32r %1, 0, %2, 0, $noreg
JMP_1 %bb.2
bb.2:
RET 0, implicit %1, implicit %3, implicit %4, implicit %5, implicit %6
...
The bug in #92 has a rather small test case which should be made into a lit regression test. The example DDG:
The def/use information:
Buggy graph transformations result in a DDG of:
However, the optimal schedule is COPY first, as it closes the live range for R0.