On Friday, February 13, 2015 at 7:49:40 PM UTC+1, jj wrote: > > To limit the number of local variables in a function, you can try the > following: > - use an aggressive optimization (-O3) to remove the number of locals, > - use the linker flag -s AGGRESSIVE_VARIABLE_ELIMINATION=1 to try to > remove the number of locals further ( > https://github.com/kripken/emscripten/blob/master/src/settings.js#L190), > - use the function outliner, e.g. -s OUTLINING_LIMIT=5000 ( > https://github.com/kripken/emscripten/blob/master/src/settings.js#L169) > - restrict LLVM use of function inlining by a) avoiding setting any > --llvm-lto if you happened to be using that, and b) setting e.g. -s > INLINING_LIMIT=50 to restrict LLVM inlining (see > https://github.com/kripken/emscripten/blob/master/src/settings.js#L169 ) > - manually break up the large function into smaller separate chunks. >
All of those together brought it from 1700 SEU down to 1100 SEU. > If none of those help, there is of course a chance that there's a > miscompilation - looking at that function, it seems to be at least special > in that it's very large, and that it uses gotos in it, which might be a > combination that's quite rare in practice. > I've now counted them: the created JavaScript function has 7044 local variables. Maybe the gotos create a control flow graph that makes it particularly hard for emcc to keep track of the local variables? Btw: at least on simple inputs that require less than 10 levels of recursions it looks like the function does the right thing. I will make some more experiments tomorrow and will get back here when I have new results. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
