Inexplicable LDC vs GDC speed difference

Johannes Pfau nospam at example.com
Thu Feb 14 00:53:58 PST 2013


Am Thu, 14 Feb 2013 01:18:21 +0100
schrieb "jerro" <a at a.com>:

> 
> When I added always_inline to juliaFunction, I got this error:
> 
> error: inlining failed in call to always_inline 
> ?main.Julia!(float).juliaFunction?: function body can be 
> overwritten at link time
> 
> Here's reduced code that gives the same error when always_inline 
> is added to bar:
> 
> int bar()(int x)
> {
>      if (x)
>          return 0;
> 
>      return 1;
> }
> 
> int foo(int a)
> {
>      return bar( a);
> }
> 
> bar can be inlined if I remove the first pair of parentheses (so 
> that it isn't a template).
> 

I'll have a look at this soon. I already have an idea what could be
wrong.

> 
> When I add always_inline to squarePlusMag I get:
> 
> error: inlining failed in call to always_inline 
> ?main.Julia!(float).ComplexStruct.squarePlusMag?: mismatched 
> arguments
> 
> Reduced code that gives the same error when always_inline is 
> added to bar:
> 
> struct S
> {
>      int bar(const S s)
>      {
>          return 0;
>      }
> }
> 
> int foo()
> {
>      S s;
>      return s.bar(s);
> }
> 
> bar can be inlined if I remove const.
> 
> I have compiled all the samples with -c -O3 -finline-functions 
> -frelease.




More information about the D.gnu mailing list