This removes all string constants for function names and compares
functions by string directly when needed. Many of these constants are
used only once or twice so the benefit of defining them separately is
not very clear, and this actually fixes a bug.
When we already have a malloc declaration which is an alias to
something else within the module,
@malloc = weak hidden alias i8* (i32), i8* (i32)* @dlmalloc
(this happens compiling with emscripten with -s WASM_OBJECT_FILES=0
because all bc files are merged before being fed into wasm-ld which
runs the backend optimizations as LTO)
[[ https://github.com/llvm/llvm-project/blob/2a2c25ba480016f8ad8fa407af7627d84547637d/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp#L512 | Module::getFunction("malloc") in canLongjmp ]] returns nullptr
because Module::getFunction [[ https://github.com/llvm/llvm-project/blob/2a2c25ba480016f8ad8fa407af7627d84547637d/llvm/lib/IR/Module.cpp#L175 | dyncasts pointer into Function ]], but the
alias is a GlobalValue but not a Function. This makes canLongjmp
[[ https://github.com/llvm/llvm-project/blob/2a2c25ba480016f8ad8fa407af7627d84547637d/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp#L514 | return false for malloc ]] in this case, and we end up adding a lot of
longjmp handling code around malloc. This is not only a code size
increase but actually a bug because malloc is used in the entry block
when preparing for setjmp tables for emscripten sjlj handling, and this
makes initial setjmp preparation, which has to happen in the entry
block, move to another split block, and this interferes with SSA update
later.
This also adds two more functions, getTempRet0 and setTempRet0, in
the list of not longjmp-able functions.
Fixes https://github.com/emscripten-core/emscripten/issues/8935.