Nowicki, Tyler
2012-Jun-18 21:22 UTC
[LLVMdev] Best way to replace LLVM IR operation with code containing control flow?
Hi, -Does anyone know where a backend-specific optimization can be added to replace an instruction with code containing control flow? I'm interested in adding an optimization for the DIV instruction (x86-atom) which replace the IDIV/DIV with code containing control flow to select between the intended IDIV/DIV and an 8-bit DIV with movzx, as described in the Intel Atom Optimization Guide. My first attempt was to add this with a custom inserter in X86ISelLowering (see EmitInstrWithCustomInserter). However, the isel already done in X86ISelDAGToDAG, line 2200, adds multiple instructions which makes adding control flow in X86ISelLowering difficult. Also, it looks like control flow cannot be added in X86ISelDAGToDAG. Any suggestions are appreciated. Thanks, Tyler Nowicki Intel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120618/06d1384d/attachment.html>
Duncan Sands
2012-Jun-19 07:45 UTC
[LLVMdev] Best way to replace LLVM IR operation with code containing control flow?
Hi Tyler,> -Does anyone know where a backend-specific optimization can be added to replace > an instruction with code containing control flow?I think the backend lowering of atomic intrinsics generates control flow (loops), so that may give you a clue. Ciao, Duncan.
Nowicki, Tyler
2012-Jun-19 16:48 UTC
[LLVMdev] Best way to replace LLVM IR operation with code containing control flow?
Thanks for the response Duncan. Inserting this code using a customer inserter (as used by atomics) would require the instructions added by X86ISelDAGToDAG to be found and removed which is counterproductive and difficult due to optimization. Inserting the code earlier, perhaps before the code becomes a DAG, would allow X86ISelDAGToDAG to insert the instructions it wants to and the optimizer to move and transform the instructions for efficiency. To reiterate, I'm interested in adding an optimization for the DIV instruction (x86-atom) which replaces the IDIV/DIV with code containing control flow to select between the intended IDIV/DIV and an 8-bit DIV, as described in the Intel Atom Optimization Guide. -Is there an earlier pass in which an instruction can be replaced by code containing control flow? Is this something I should add? Thanks, Tyler Nowicki Intel -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands Sent: Tuesday, June 19, 2012 3:45 AM To: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Best way to replace LLVM IR operation with code containing control flow? Hi Tyler,> -Does anyone know where a backend-specific optimization can be added > to replace an instruction with code containing control flow?I think the backend lowering of atomic intrinsics generates control flow (loops), so that may give you a clue. Ciao, Duncan. _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Maybe Matching Threads
- [LLVMdev] Best way to replace LLVM IR operation with code containing control flow?
- [LLVMdev] Packed instructions generaetd by LoopVectorize?
- [LLVMdev] Generate scalar SSE instructions instead of packed instructions
- [LLVMdev] Packed instructions generaetd by LoopVectorize?
- [LLVMdev] 8-bit DIV IR irregularities