[llvm-dev] Question about register allocator error

Leijsten, G.H.P. via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 20 11:24:27 PST 2017


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<def> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg140 VRegs:%vreg53,%vreg77

spill:
reload:
rewrite: 1512r %vreg79<def> = VCMOVvv %vreg141<kill>, %vreg76, %vreg77; VRegs:%vreg79,%vreg76,%vreg77 VP0Regs:%vreg141

This is before it is rewritten:

%vreg78<def> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg78 VRegs:%vreg53,%vreg77
%vreg80<def> = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134
%vreg76<def> = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75
%vreg85<def> = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134
%vreg81<def> = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74
%vreg83<def> = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77
%vreg86<def> = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85
%vreg79<def> = 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<def> = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134
%vreg76<def> = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75
%vreg85<def> = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134
%vreg81<def> = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74
%vreg83<def> = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77
%vreg86<def> = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85
%vreg79<def> = 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171220/62b54df0/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: reading_virt_reg_without_def_error.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171220/62b54df0/attachment-0002.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debug_output.txt
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171220/62b54df0/attachment-0003.txt>


More information about the llvm-dev mailing list