emscripten-core / emscripten-core/emscripten
"WebAssembly Fix Irreducible Control Flow" pass causes OOM on a huge function
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Emscripten 2.0.6 consumes 10GiB of memory and is OOM-killed when compiling a source file with a huge function in it.
For ease of reproduction I am including LLVM IR of the source file: [disasm.ll](https://gist.githubusercontent.com/mejedi/f863ece38189ad9026c4096c8e98918a/raw/e14887805de6c6fbfacb5e2e4864e88244483666/disasm.ll)
`em++ -c disasm.ll -mllvm -debug-pass=Executions`
The last line printed:
`[2020-12-08 19:16:08.463129734] 0x2d4fc70 Executing Pass 'WebAssembly Fix Irreducible Control Flow' on Function '_ZNK5clang6interp8Function4dumpERN4llvm11raw_ostreamE'`
The footprint of clang process starts slowly growing. After exceeding 10GiB, it is OOM killed.
FYI: the source code is `clang/lib/AST/Interp/Disasm.cpp` from llvm project, tagged `llvmorg-11.0.0`.
Contributor guide
Assessment
This issue has not been assessed yet.