[LLVMdev] interesting LLVM code optimization issue regarding timer registers

reed kotler rkotler at mips.com
Fri Feb 21 11:12:16 PST 2014


This problem was reported to me by a friend who has an LLVM port that is 
not put back to open source.

Essentially, there is an intrinsic call _lr which is a load register.

so then user code has something like:

start_time = _lr(TIMER_REGISTER)
.....
some_code_to_time
....
end_time = _lr(TIMER_REGISTER)

So what happens is that LLVM moves the code as follows:



start_time = _lr(TIMER_REGISTER)
end_time = _lr(TIMER_REGISTER)
.....
some_code_to_time
......

How would this intrinsic be implemented properly in llvm so this cannot 
happen?

TIA.

Reed






More information about the llvm-dev mailing list