[PATCH] D55467: [WebAssembly] Optimize Irreducible Control Flow

Alon Zakai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 7 17:39:14 PST 2018


kripken created this revision.
kripken added reviewers: sunfish, aheejin.
Herald added subscribers: llvm-commits, mgrang, jgravelle-google, sbc100, dschuff.

Irreducible control flow is not that rare, e.g. it happens in malloc and 3 other places in the libc portions linked in to a hello world program. This patch improves how we handle that code: it emits a br_table to dispatch to only the minimal necessary number of blocks. This reduces the size of malloc by 33%, and makes it comparable in size to asm2wasm's malloc output.

Added some tests, and verified this passes the emscripten-wasm tests run on the waterfall (binaryen2, wasmobj2, other).


Repository:
  rL LLVM

https://reviews.llvm.org/D55467

Files:
  lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp
  test/CodeGen/WebAssembly/irreducible-cfg-exceptions.ll
  test/CodeGen/WebAssembly/irreducible-cfg-nested.ll
  test/CodeGen/WebAssembly/irreducible-cfg-nested2.ll
  test/CodeGen/WebAssembly/irreducible-cfg.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55467.177363.patch
Type: text/x-patch
Size: 32832 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181208/35121a48/attachment-0001.bin>


More information about the llvm-commits mailing list