石博文 via llvm-dev
2018-Nov-13 03:14 UTC
[llvm-dev] How to add a pass to do zero check for all DIV instructions
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* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181113/cd207b2b/attachment.html>
Jeremy Lakeman via llvm-dev
2018-Nov-13 04:19 UTC
[llvm-dev] How to add a pass to do zero check for all DIV instructions
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>