On 04/06/2017 11:06 AM, Vittorio Romeo wrote:
Could someone clarify why the generated assembly for
void main() @nogc {
import std.algorithm;
enum a = [3, 1, 2, 0]; // inferred to be int[]
enum b = sort(a);
static assert(b[0] == 0);
}
is 1380 lines with ldc 1.3.0 (-O3 -release -betterC -flto=full)?
You can see the result on godbolt here:
https://godbolt.org/g/BNRnO9
It's kind of surprising compared to C++'s 2 lines:
https://godbolt.org/g/vXrxaY
_Dmain is exactly 2 instructions, so nope equivalent :)
The linker isn't stripping out unused symbols however (from what I can
tell).