[llvm-dev] How to add a pass to do zero check for all DIV instructions

Jeremy Lakeman via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 12 20:19:52 PST 2018


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.

On 13 November 2018 at 13:44, 石博文 via llvm-dev <llvm-dev at lists.llvm.org>
wrote:

> 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)
>
> before:
> ```
> IDIV EBX
> ```
>
> after:
> ```
> TEST EBX, EBX
> JNZ L1
> MOV EBX, 1
> L1:
> IDIV EBX
> ```
>
> I think it's need to modify some code in instruction generate pass, but I
> don't know where is the relation files.
>
> --
> *B. W. Shek*
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181113/3cda9a8e/attachment.html>


More information about the llvm-dev mailing list