[LLVMdev] Prevent instruction elimination

Xinfinity
Mon, 25 Oct 2010 09:13:04 -0000

Hello,

Does there exist something like a "dummy" instruction that is not
removed by
the optimizers, even if it seems to be dead code?
I want to use such instructions to carry metadata information, but they
should have a minimal impact on the code generation and optimization. I used
an add instruction:

%0 = add i8 1, 2,  !pragma_instrument_mem_add !0    ; <i8> [#uses=0]

which should not carry any dependencies, if inserted inside a loop for
instance. But the problem is that it is removed when I use the optimization
level -O2. Is there a way to prevent this?
I would like to attach metadata to instructions rather than using intrinsics
that reference metadata.


Thank you,
Alexandra
--
View this message in context: