Open llvmbot opened 3 years ago
I've found a workaround. The overall code layout is as follows:
foreach instr in chunk: switch instr.opcode: case op1: printOp1NameLoop ... case op2: printOp2NameLoop ... ...
There are 446 opcodes in total. Under each case label there's a nested loop printing the name of the particular opcode. Each loop is created due to PrintName lambda function getting inlined.
Compilation time went back to normal after preventing the lambda function from getting inlined.
No problem, that's what I figured. I just wanted to clarify that I can find time for this eventually, but it won't be any time soon since I'm swamped, so others should feel free to take it. (If leaving someone as "assignee" in this bug tracker doesn't fit that, feel free to unassign me - I'm just not familiar with the process here in LLVM-land.)
@kripken, I picked you because IIRC you wrote that code, but I should probably have just CC'd you and let you decide if you want to take it on.
I'm not sure what the LLVM usage of the "assignee" field is. I may not have time to look at this any time soon, so if someone else wants to look earlier, feel free to unassign me. Otherwise you can leave me assigned.
When there's enough RAM, it takes over 200 seconds to complete the pass.
[2020-12-09 11:56:34.086331000] 0x7ffdd020e550 Executing Pass 'WebAssembly Fix Irreducible Control Flow' on Function '_ZNK5clang6interp8Function4dumpERN4llvm11raw_ostreamE'...
[2020-12-09 11:59:01.839372000] 0x7ffdd020e550 Freeing Pass 'WebAssembly Fix Irreducible Control Flow' on Function '_ZNK5clang6interp8Fu
assigned to @kripken
@llvm/issue-subscribers-backend-webassembly
Extended Description
Clang/lib/AST/Interp/Disasm.cpp takes excessive time and resources to compile when targeting WebAssembly. Memory usage exceeds 10GiB. It tends to OOM in smaller machines.
The frontend completes without issues.
When running
clang -c Disasm.bc -mllvm -debug-pass=Executions
the last line printed before OOM is
[2020-12-08 19:16:08.463129734] 0x2d4fc70 Executing Pass 'WebAssembly Fix Irreducible Control Flow' on Function '_ZNK5clang6interp8Function4dumpERN4llvm11raw_ostreamE'