<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi all,
<div class=""><br class="">
</div>
<div class="">I have resolved the problem. <span style="color: rgb(69, 69, 69); font-family: 'Helvetica Neue';" class="">VP0Regs had only one flag register. So it had difficulties when it needed more than one register.</span></div>
<div class=""><font color="#454545" face="Helvetica Neue" class=""><br class="">
</font></div>
<div class=""><font color="#454545" face="Helvetica Neue" class="">This question is not relevant anymore.</font></div>
<div class=""><font color="#454545" face="Helvetica Neue" class=""><br class="">
</font></div>
<div class=""><font color="#454545" face="Helvetica Neue" class=""><br class="">
</font></div>
<div class=""><font color="#454545" face="Helvetica Neue" class="">Kind regards,</font></div>
<div class=""><font color="#454545" face="Helvetica Neue" class="">Guus Leijsten</font></div>
<div class=""><font color="#454545" face="Helvetica Neue" class=""><br class="">
</font>
<div>
<blockquote type="cite" class="">
<div class="">On 20 Dec 2017, at 20:24, Leijsten, G.H.P. <<a href="mailto:g.h.p.leijsten@student.tue.nl" class="">g.h.p.leijsten@student.tue.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi,
<div class=""><br class="">
</div>
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Perhaps some of you have seen this error before or maybe someone has any idea on how to fix it?</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">From the debug information I can deduce that the register allocator tries to rewrites two operations, but that is where it goes wrong.</div>
<div class="">
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
<br class="">
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
This is a snippet taken from the debug information.</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
</div>
<blockquote type="cite" class="">
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
spillAroundUses %vreg78</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
rewrite: 1360r<span class="Apple-tab-span" style="white-space: pre;"> </span>%vreg140<def> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg140 VRegs:%vreg53,%vreg77</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69); min-height: 14px;" class="">
<br class="">
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
spill: </div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
reload: </div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
rewrite: 1512r<span class="Apple-tab-span" style="white-space: pre;"> </span>%vreg79<def> = VCMOVvv %vreg141<kill>, %vreg76, %vreg77; VRegs:%vreg79,%vreg76,%vreg77 VP0Regs:%vreg141</div>
</blockquote>
</div>
<div class=""><br class="">
</div>
<div class=""><i class="">This is before it is rewritten:</i></div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<b class=""><font color="#ff2600" class="">%vreg78</font><font color="#454545" class=""><def> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg78 VRegs:%vreg53,%vreg77</font></b></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg80<def> = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg76<def> = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg85<def> = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg81<def> = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg83<def> = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg86<def> = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<b class=""><font color="#454545" class="">%vreg79<def> = VCMOVvv </font><font color="#ff2600" class="">%vreg78</font><font color="#454545" class="">, %vreg76, %vreg77; VRegs:%vreg79,%vreg76,%vreg77 VP0Regs:</font><font color="#ff2600" class="">%vreg78</font></b></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
<b class=""><br class="">
</b></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
<i class="">This is after it is rewritten:</i></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69); min-height: 15px;" class="">
<br class="">
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; min-height: 15px;" class="">
<font color="#ff2600" class=""><b class="">%vreg140</b></font><span style="color: rgb(69, 69, 69);" class=""><b class=""><def,dead> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg140 VRegs:%vreg53,%vreg77</b></span></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69); min-height: 15px;" class="">
%vreg80<def> = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134<b class=""></b></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg76<def> = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg85<def> = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg81<def> = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg83<def> = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue'; color: rgb(69, 69, 69);" class="">
%vreg86<def> = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<b class=""><font color="#454545" class="">%vreg79<def> = VCMOVvv </font><font color="#ff2600" class="">%vreg141</font><font color="#454545" class="">, %vreg76, %vreg77; VRegs:%vreg79,%vreg76,%vreg77 VP0Regs:</font><font color="#ff2600" class="">%vreg141</font></b></div>
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<b class=""><font color="#ff2600" class=""><br class="">
</font></b></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
So, it seems to accidentally create a new virtual register for the second operation that is rewritten. Maybe, it should have used
<i class="">%vreg140</i>.</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<br class="">
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<br class="">
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
Any thoughts?</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<br class="">
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<br class="">
</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
Cheers,</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
Guus Leijsten</div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<b class=""><font color="#ff2600" class=""><br class="">
</font></b></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
<b class=""><font color="#ff2600" class=""><br class="">
</font></b></div>
<div style="margin: 0px; line-height: normal; font-family: 'Helvetica Neue';" class="">
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. </div>
<div class=""><br class="">
</div>
<div class=""></div>
</div>
<span id="cid:D6B4C8D2-F2F1-4A9C-B85F-7C4C6FDE2BF0@dynamic.ziggo.nl"><reading_virt_reg_without_def_error.txt></span>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""></div>
</div>
<span id="cid:BC8367FF-5632-4F8A-8C89-23CDC5CE51DF@dynamic.ziggo.nl"><debug_output.txt></span>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class=""></div>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>