[LLVMdev] Memset/memcpy: user control of loop-idiom recognizer
rob.lougher at gmail.com
Fri Dec 5 09:22:23 PST 2014
On 5 December 2014 at 17:09, David Chisnall <David.Chisnall at cl.cam.ac.uk> wrote:
> On 5 Dec 2014, at 16:02, Robert Lougher <rob.lougher at gmail.com> wrote:
>> The blunt fact is that game
>> developers don't like their loops being replaced and they want user
>> control. The real conversation I wanted was what form should this
>> user control take.
> This doesn't really make sense. They're writing code in a high(ish)-level language and passing it to a compiler. The processor doesn't understand C, so the compiler *must* replace it with something. Whether that's a call to a library routine, a scalar loop, a vector loop, or a completely unrolled sequence depends on heuristics in the compiler.
Yes, but why isn't the user allowed any control over what the compiler does?
> If they want full control of the machine instructions that are generated, then there is a mechanism for doing this: inline assembly.
Of course they could do this, but this is like having to make your
deli sandwich yourself instead of telling the guy to "hold the mayo".
> The complaint can't be that it's not generating the same code, it is that the compiler is generating something with performance characteristics that are difficult to reason about from the input code. That's always a danger when you use an optimising compiler, but it looks like this case is a pretty extreme example.
More information about the llvm-dev