[LLVMdev] Best way to replace LLVM IR operation with code containing control flow?

Nowicki, Tyler tyler.nowicki at intel.com
Tue Jun 19 09:48:25 PDT 2012


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




More information about the llvm-dev mailing list