[LLVMdev] interesting LLVM code optimization issue regarding timer registers

James Courtier-Dutton james.dutton at gmail.com
Wed Feb 26 02:11:10 PST 2014


On 21 February 2014 19:12, reed kotler <rkotler at mips.com> wrote:
> 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
>

Do we need something equivalent to gcc's
emit_insn (gen_blockage ());



More information about the llvm-dev mailing list