[MLton] MLton codegen combines divison on arm

Wesley W. Terpstra wesley at terpstra.ca
Mon Oct 25 13:52:02 PDT 2010


I've been trying to get arm to pass the regression suite cleanly. It
currently fails whenever the rounding mode should be set via
fe(get/set)round. I've found the right flags to get these working for
an example C program, but I can't get regression/ieee-real.sml to
work. I've confirmed that it indeed calls and correctly sets the
rounding mode. The problem seems to be in the MLton C codegen itself.

Normally when I build ieee-real.sml using the C codegen, there is in
ieee-real.0.c these lines:
static void real_Init() {
        globalReal64[0] = 0.1E1;
        globalReal64[1] = 0.1E2;
}
But on the arm it reads:
static void real_Init() {
}

I can only conclude that MLton has optimized the 1.0/10.0 away! Indeed
there are no calls to Real64_div in ieee-real.1.c on arm, while there
are 4 such calls on other architectures. There must be a toggle
somewhere in MLton that is letting it think that it is safe to
optimize away the division, but I can't for the life of me find it.



More information about the MLton mailing list