> Can we be sure that this optimization works fine on other compilers (gdc, ldc)?

Just try it in C code but it's a fairly simple optimization so I think they do it as well.