<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Matthias,</p>
<p><br>
</p>
<p>Sorry for the late reply. </p>
<p>Yes, you are correct, I do have optnone attribute on my function. <br>
</p>
<p>I did pass -O0 to the tools. </p>
<p><br>
</p>
<p>For your information, my invocations are as below:</p>
<p><br>
</p>
<p>clang  --target=mips-unknown-linux  -mips32  test.c  -emit-llvm  -S</p>
<p>llc  -O0  -march=mips  -mcpu=mips32  test.ll  -o  test.s</p>
<p><br>
</p>
<p>Based on the generated .ll file, there is optnone attribute on the function, i am guessing this is due to the default optimization -O0 by clang if not specified.</p>
<p>As for the llc, i tried to invoke it with -O1,-O2,-O3. All of them resulted in failure during the phase "PROCESS IMPLICIT DEFS"</p>
<p>This message showed up:<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> mbraun@apple.com <mbraun@apple.com> on behalf of Matthias Braun <mbraun@apple.com><br>
<b>Sent:</b> Saturday, September 9, 2017 2:06 AM<br>
<b>To:</b> jin chuan see<br>
<b>Cc:</b> llvm-dev@lists.llvm.org<br>
<b>Subject:</b> Re: [llvm-dev] Live Register Spilling</font>
<div> </div>
</div>
<div>
<div class="">This would be a lot easier to discuss having a concrete example, llc invocations etc.</div>
<div class=""><br class="">
</div>
<div class="">It sounds like you are using RegAllocFast, have you tried using the optimized register allocators (= make sure you don't have the optnone attribute on your function and are not passing -O0 to the tools).</div>
<div class=""><br class="">
</div>
<div class="">- Matthias</div>
<div class=""><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">On Sep 8, 2017, at 12:10 AM, jin chuan see via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div id="divtagdefaultwrapper" dir="ltr" class="" style="font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; font-size:12pt; font-family:Calibri,Helvetica,sans-serif">
<div class="" style="margin-top:0px; margin-bottom:0px">Hi All,<span class="Apple-converted-space"> </span><br class="">
</div>
<br class="">
<div class="" style="margin-top:0px; margin-bottom:0px">I faced some problems while using the BuildMI().</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Currently, i am trying to replace specific MI with a series of new MI.</div>
<div class="" style="margin-top:0px; margin-bottom:0px">I wrote a routine under the processFunctionAfterISel() to detect the targeted MI and replace it accordingly.</div>
<div class="" style="margin-top:0px; margin-bottom:0px">After using BuildMI() to perform my replacement, i realize there are unnecessary spilling and reloading of registers in the assembly generated.</div>
<div class="" style="margin-top:0px; margin-bottom:0px">By checking the llc debug output, i am suspecting that the virtual register states have been completely messed up.</div>
<div class="" style="margin-top:0px; margin-bottom:0px">This is because the spilling and reloading codes are only inserted at the register allocation phase, especially during the state of "Spilling live registers at the end of block".</div>
<div class="" style="margin-top:0px; margin-bottom:0px">These spilling and reloading codes are messing up the assembly generated, and the behavior of the code generated is undetermined.<span class="Apple-converted-space"> </span><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">I would like to know is there anything i can do to fix the virtual register use-def relationship?</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Or is there any standard procedure i should follow to handle the MachineOperands while using BuildMI()?</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Any opinions or suggestion are welcomed.<br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px"><br class="">
</div>
<div class="" style="margin-top:0px; margin-bottom:0px">Regards,</div>
<div class="" style="margin-top:0px; margin-bottom:0px">JC<br class="">
</div>
</div>
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">_______________________________________________</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<span class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; float:none; display:inline!important">LLVM
 Developers mailing list</span><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="mailto:llvm-dev@lists.llvm.org" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">llvm-dev@lists.llvm.org</a><br class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="" style="font-family:Helvetica; font-size:12px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</body>
</html>