[LLVMdev] interesting LLVM code optimization issue regarding timer registers

reed kotler rkotler at mips.com
Fri Feb 21 11:39:02 PST 2014


He has tried this and it does not solve the problem.

The problem is that someone wants to, for example, time a dsp instruction.

THe dsp instruction has no side effects and does not access memory.

It's a valid thing to do.

Should be some way to do this I would think.

Tia.

Reed

On 02/21/2014 11:24 AM, Tim Northover wrote:
> Hi Reed,
>
>> How would this intrinsic be implemented properly in llvm so this cannot
>> happen?
> At the intrinsic level, you'd make sure @llvm.whatever had the most
> side-effecty definition possible (I think it's actually the default:
> "this may read or write completely random memory wherever it feels
> like").
>
> At the instruction level, you'd make sure hasSideEffects=1 was set.
>
> Theoretically, a completely side-effect-free sequence of instructions
> might still be moved around, but you're almost certainly Doing It
> Wrong if that affects you: LLVM is always going to be able to insert
> COPYs, spills and various other bits in there that you didn't write
> down.
>
> Cheers.
>
> Tim.





More information about the llvm-dev mailing list