Hi,
I have been wrestling with a bug that the LLVM compiler has. The target architecture is an ultra wide SIMD with two issue slots. A CP that is responsible for the control flow and a wide array of PE elements. I am currently working on this compiler for my graduation project at the Eindhoven University of Technology in the Netherlands.
Perhaps some of you have seen this error before or maybe someone has any idea on how to fix it?
From the debug information I can deduce that the register allocator tries to rewrites two operations, but that is where it goes wrong.
This is a snippet taken from the debug information.
spillAroundUses %vreg78
rewrite: 1360r %vreg140 = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg140 VRegs:%vreg53,%vreg77spill:
reload:
rewrite: 1512r %vreg79 = VCMOVvv %vreg141, %vreg76, %vreg77; VRegs:%vreg79,%vreg76,%vreg77 VP0Regs:%vreg141
This is before it is rewritten:
%vreg78 = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg78 VRegs:%vreg53,%vreg77
%vreg80 = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134
%vreg76 = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75
%vreg85 = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134
%vreg81 = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74
%vreg83 = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77
%vreg86 = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85
%vreg79 = VCMOVvv %vreg78, %vreg76, %vreg77; VRegs:%vreg79,%vreg76,%vreg77 VP0Regs:%vreg78
This is after it is rewritten:
%vreg140**<def,dead> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg140 VRegs:%vreg53,%vreg77**
%vreg80 = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134
%vreg76 = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75
%vreg85 = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134
%vreg81 = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74
%vreg83 = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77
%vreg86 = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85
%vreg79 = VCMOVvv %vreg141, %vreg76, %vreg77; VRegs:%vreg79,%vreg76,%vreg77 VP0Regs:%vreg141
So, it seems to accidentally create a new virtual register for the second operation that is rewritten. Maybe, it should have used %vreg140.
Any thoughts?
Cheers,
Guus Leijsten
P.S. There are 2 txt files attached to this email. One contains the actual error that “Bad machine code: Reading virtual register without a def”, and the other file has a selection of the debug information.
reading_virt_reg_without_def_error.txt (11.8 KB)
debug_output.txt (46.3 KB)