[LLVMdev] Prevent instruction elimination

Xinfinity xinfinity_a at yahoo.com
Mon Oct 25 02:13:04 PDT 2010


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: http://old.nabble.com/Prevent-instruction-elimination-tp30046067p30046067.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list