Force LDC/LLVM to split a struct local (into registers)?

Vladimir Panteleev thecybershadow.lists at gmail.com
Thu Sep 19 23:48:35 UTC 2019


On Thursday, 19 September 2019 at 23:14:49 UTC, kinke wrote:
> Can reproduce on Win64 (after fixing up your temp file path 
> changes ;)).

Ah, sorry about that, I had already fixed it on master.

> The following patch restores previous performance:

Thanks! That's interesting, though not really what I was trying 
to do. My goal was to move the "manually inlined" statements into 
a Hash method. I figured that if I could get the compiler to 
break up the Hash struct and put some fields into registers, it 
would have no trouble inlining a Hash method which worked with 
them.

For now I settled on passing all the locals to a free function:

https://github.com/CyberShadow/chunker/blob/12b5b2d543867a67db2a28b7eb70b25efef53e70/src/chunker/package.d#L399

This does inline nicely but still precludes encapsulating the 
logic into an "opaque" Hash struct while maintaining performance.



More information about the digitalmars-d-ldc mailing list