foreach thoughts

David Nadlinger code at klickverbot.at
Tue Jan 14 18:22:21 PST 2014


On Wednesday, 15 January 2014 at 01:42:07 UTC, Manu wrote:
> Right, thanks for that.
> I'm quite surprised by how bad that turned out actually, and 
> with LDC,
> which is usually the best at optimising that sort of thing.
> Need to do some intensive experimentation... but this is a bit 
> concerning.

GCC might do some loop merging, I haven't checked. It's just that 
this pattern doesn't tend to appear too much in traditional C/C++ 
code (after all, who splits up their loops into two parts just 
for fun?), so it could be that the LLVM people just never really 
bothered to write a pass to merge single loops that have been 
split (as opposed to classical loop fusion, where the loop ranges 
are the same, but the operations performed/target data different).

Maybe it would be possible to implement something like this 
fairly easily using the existing LLVM loop analyses though.

David


More information about the Digitalmars-d mailing list