[PATCH] D81628: [WebAssembly] Make BR_TABLE non-duplicable

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 19:57:38 PDT 2020


tlively created this revision.
tlively added reviewers: aheejin, dschuff.
Herald added subscribers: llvm-commits, sunfish, hiraditya, jgravelle-google, sbc100.
Herald added a project: LLVM.

After their range checks were removed in 7f50c15be5c0 <https://reviews.llvm.org/rG7f50c15be5c020b2789f83dc3c87d28f8294664f>, br_tables
started being duplicated into their predecessors by tail
folding. Unfortunately, when the br_tables were in loops this
transformation introduced bad irreducible control flow which was later
expanded into even more br_tables. This commit abuses the
`isNotDuplicable` property to prevent this irreducible control flow
from being introduced. This change saves a few dozen bytes of code
size and has a negligible affect on performance for most of the large
Emscripten benchmarks, but can improve performance significantly on
microbenchmarks of switches in loops.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81628

Files:
  llvm/lib/Target/WebAssembly/WebAssemblyInstrControl.td
  llvm/test/CodeGen/WebAssembly/indirectbr.ll
  llvm/test/CodeGen/WebAssembly/switch-in-loop.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81628.270024.patch
Type: text/x-patch
Size: 5389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200611/bc16bf11/attachment.bin>


More information about the llvm-commits mailing list