Re: Can D optimize?

2019-06-09 Thread Johan Engelen via Digitalmars-d-learn
On Sunday, 9 June 2019 at 05:24:56 UTC, Amex wrote: Can dmd or ldc optimize the following cases: foo(int x) { if (x > 10 && x < 100) bar1; else bar2; } ... for(int i = 23; i < 55; i++) foo(i); // equivalent to calling bar1(i) clearly i is within the range of the if in foo and so the

Can D optimize?

2019-06-08 Thread Amex via Digitalmars-d-learn
Can dmd or ldc optimize the following cases: foo(int x) { if (x > 10 && x < 100) bar1; else bar2; } ... for(int i = 23; i < 55; i++) foo(i); // equivalent to calling bar1(i) clearly i is within the range of the if in foo and so the checks are unnecessary. I realize that this is