<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="" style="word-wrap:break-word">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 class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
<br class="">
</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
This is a snippet taken from the debug information.</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
</div>
<blockquote type="cite" class="">
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
spillAroundUses %vreg78</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
rewrite: 1360r<span class="x_Apple-tab-span" style="white-space:pre"> </span>%vreg140<def> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg140 VRegs:%vreg53,%vreg77</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69); min-height:14px">
<br class="">
</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
spill: </div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
reload: </div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
rewrite: 1512r<span class="x_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 class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<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 class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg80<def> = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg76<def> = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg85<def> = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg81<def> = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg83<def> = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg86<def> = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<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 class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
<b class=""><br class="">
</b></div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
<i class="">This is after it is rewritten:</i></div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69); min-height:15px">
<br class="">
</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; min-height:15px">
<font color="#ff2600" class=""><b class="">%vreg140</b></font><span class="" style="color:rgb(69,69,69)"><b class=""><def,dead> = VSFGTSP0vv %vreg53, %vreg77; VP0Regs:%vreg140 VRegs:%vreg53,%vreg77</b></span></div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69); min-height:15px">
%vreg80<def> = COPY %vreg134; VRegs:%vreg80 GRegs:%vreg134<b class=""></b></div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg76<def> = VCMOVvv %vreg75, %vreg53, %vreg74; VRegs:%vreg76,%vreg53,%vreg74 VP0Regs:%vreg75</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg85<def> = ADDrr %vreg3, %vreg134; GRegs:%vreg85,%vreg3,%vreg134</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg81<def> = VSFLTSP0vv %vreg65, %vreg74; VP0Regs:%vreg81 VRegs:%vreg65,%vreg74</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg83<def> = VSFGTSP0vv %vreg65, %vreg77; VP0Regs:%vreg83 VRegs:%vreg65,%vreg77</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'; color:rgb(69,69,69)">
%vreg86<def> = COPY %vreg85; VRegs:%vreg86 GRegs:%vreg85</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<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 class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<b class=""><font color="#ff2600" class=""><br class="">
</font></b></div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
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 class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<br class="">
</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<br class="">
</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
Any thoughts?</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<br class="">
</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<br class="">
</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
Cheers,</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
Guus Leijsten</div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<b class=""><font color="#ff2600" class=""><br class="">
</font></b></div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
<b class=""><font color="#ff2600" class=""><br class="">
</font></b></div>
<div class="" style="margin:0px; line-height:normal; font-family:'Helvetica Neue'">
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>
<div style="word-wrap:break-word">
<div></div>
</div>
<div class="" style="word-wrap:break-word">
<div class=""></div>
</div>
</body>
</html>