LDC 1.5-1.6 huge degradation of optimization

Igor Shirkalin mathsoft at inbox.ru
Thu Nov 30 11:25:13 UTC 2017


On Thursday, 30 November 2017 at 08:56:31 UTC, Johan Engelen 
wrote:
> On Monday, 27 November 2017 at 10:41:44 UTC, Igor Shirkalin 
> This will need a lot more investigation to figure out what is 
> going wrong. It could be that the optimization pipeline set up 
> by LDC needs to be adjusted for newer LLVM versions, or that 
> extra annotations are needed.

I'm almost sure that the problem is in new LLVM.

> Some notes:

> - It's strange that adding the calculation of `sum` leads to an 
> overall more optimized output with AVX2 instructions (good that 
> you found out about that!).

> - It would help if you find a C/C++ equivalent to show the 
> problem to LLVM devs (gcc.godbolt.org has all relevant 
> LLVM/Clang versions)

Yes, I have found it for clang: 
https://bugs.llvm.org/show_bug.cgi?id=35448

> - The optimization is fragile also in LDC 1.4: manual unrolling 
> of the inner loop somehow removes the AVX2 optimizations. 
> https://godbolt.org/g/NF3eHf  Did I make a mistake?

I've noticed that manual unrolling usually doesnt't help to 
vectorize the code.


> -Johan




More information about the digitalmars-d-ldc mailing list