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 checks are unnecessary.
This is a simple case of inlining for the optimizer, so works out well with LDC and GDC:
https://d.godbolt.org/z/pLy8Yy -Johan