<div dir="ltr">If you write a pass that runs against IR, other optimisations may be able to prove when the value is zero and remove the test.</div><div class="gmail_extra"><br><div class="gmail_quote">On 13 November 2018 at 13:44, 石博文 via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi. I'm a new learner for LLVM. I want to write a pass to add some custom instructions to check zero for DIV. (X86-64 architecture)<br></div><div><br></div><div>before:</div><div>```<br></div><div>IDIV EBX<br></div><div>```</div><div><br></div><div>after:</div><div>```</div><div>TEST EBX, EBX</div><div>JNZ L1</div><div>MOV EBX, 1<br></div><div>L1:</div><div>IDIV EBX<br></div><div>```</div><div><br></div><div>I think it's need to modify some code in instruction generate pass, but I don't know where is the relation files.</div><span class="HOEnZb"><font color="#888888"><div><br>-- <br><div dir="ltr"><div dir="ltr"><div style="text-align:right"><font size="1"><span style="color:rgb(11,83,148)"><span style="font-family:monospace,monospace"><b><u>B. W. Shek</u></b></span></span></font><br></div></div></div></div></font></span></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>