[LLVMdev] Testing Target Optimization via ASM Injection
rengolin at systemcall.org
Wed Dec 19 09:42:29 PST 2012
If you're looking for the optimizations that do run on
MachineIntructions, than yes, you might benefit on your inline ASM.
This blog post has a very high-level description on how to print the
intermediate states of your code:
including DAG nodes and MachineInstr / MachineBasicBlock which is what
you're looking for.
Maybe you could use that in your tests. Insert inline ASM on a C file,
see how it gets represented in IR, and use IR-based tests from then
on. Then run llc on it and print the various informations you need to
create the tests.
I think this should get you going...
On 19 December 2012 05:25, Isaac Asay <iasay at calpoly.edu> wrote:
> Hi Renato,
> Thanks for the response. While it is true that creating an IR optimization
> gives a better return due to it being applicable to any target ASM, there
> are also a lot of target specific optimizations that devs have felt are
> worthwhile enough to create, such as the ARMLoadStoreOptimizer.cpp file
> which contains ARM specific ASM optimizations. So I know that target
> specific optimizations are being created and tested, and since I've already
> gone and created the target specific optimization I'd like to be able to
> validate that it's working as expected in different test cases. What I'm
> really looking for is a set of tools to make it easier to generate specific
> ASM test cases, which I presume must exist somewhere since similar ARM
> optimizations have been created/tested before.
> On Mon, Dec 10, 2012 at 3:50 AM, Renato Golin <rengolin at systemcall.org>
>> On 10 December 2012 03:00, Isaac Asay <iasay at calpoly.edu> wrote:
>> > I've also tried using asm() C calls to force a
>> > specific assembly pattern, but LLVM appears to treat the asm() call like
>> > a
>> > single atomic block that does not have the optimizer run on its member
>> > instructions.
>> Hi Isaac,
>> AFAIK, inline assembly is only exported at the end and it's generally
>> kept intact, since the compiler has no way to know whether you wanted
>> all the side effects of your hand-coded assembly or not.
>> Also, most LLVM optimizations run on IR, not assembly, so by writing
>> it ASM, you lose most of the power of LLVM. Even if there is a way to
>> enable the compiler to change your inline ASM, the improvements would
>> be very limited.
More information about the llvm-dev