Battle-plan for CTFE

Stefam Koch via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Tue Oct 25 05:36:56 PDT 2016


On Tuesday, 25 October 2016 at 09:36:12 UTC, Stefam Koch wrote:
> On Monday, 24 October 2016 at 06:37:12 UTC, Rory McGuire wrote:
>> Cool, thanks for the feedback.
>
>
> I have take care of the blocker for now.
> I turns out my tests contained wrong code that reused a 
> register for multiple purposes.
> LLVM does not like that.
> So it assumed the wrong things while optimising and went into 
> the wrong direction makeing complete bogus out of valid code.

First perf data is in

The is measured with time src/dmd -c -ctfe-bc

old interpreter (without -ctfe-bc) :

real	0m6.839s
user	0m6.423s
sys	0m0.407s

new interpreter (-ctfe-bc)

real	0m0.549s
user	0m0.547s
sys	0m0.000s

LLVM Backend (-ctfe-bc -version=UseLLVMBackend) :

real	0m0.039s
user	0m0.027s
sys	0m0.010s


The compiled code was :
int bug6498(int x)
{
     int n = 0;
     while (n < x)
         ++n;
     return n;
}
static assert(bug6498(10_000_000)==10_000_000);



More information about the Digitalmars-d-announce mailing list