[LLVMdev] Prevent instruction elimination

Xinfinity xinfinity_a at yahoo.com
Mon Oct 25 09:45:56 PDT 2010




Devang Patel wrote:
> 
> 
> Use of metadata will not prevent optimizer from removing an instruction.
> Actually, that is the corner stone of LLVM metadata design. 
> 
> I am curious, what information you want to carry and until what point ?
> -
> Devang
> 
> 

I want to handle new pragma inserted in the C/C++ source code and to adapt
clang to transform them in metadata information. I want to keep this
information until I run some passes on the *.bc files and manipulate the
code. Then, I delete those "dummy" instructions. 
I want to transform this:
#pragma my_pragma {

C/C++ code
C/C++ code
}

into 
LLVM_dummy_inst1 , !metadata_info !0
optimized LLVM code
optimized LLVM code
LLVM_dummy_inst2, !metadata_info !1

but if I run this with clang -O2 or with opt -O2, my dummy_inst are removed,
so I cannot find the pragmas in the LLVM IR.

I know that metadata will not prevent the elimination, but I am asking if
there is any way to prevent this, or what kind of instructions I could use
to have a minimal influence on the optimizers.

Alexandra
-- 
View this message in context: http://old.nabble.com/Prevent-instruction-elimination-tp30046067p30049711.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.




More information about the llvm-dev mailing list