OSDN Git Service

[WebAssembly] Emit br_table for most switch instructions
authorHeejin Ahn <aheejin@gmail.com>
Tue, 23 Apr 2019 21:30:30 +0000 (21:30 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Tue, 23 Apr 2019 21:30:30 +0000 (21:30 +0000)
commit65db0de9a638dc3c1aa9f8ece7eaa982bcd38185
tree4a698e663ab892fd5befb95c97b76dadb906a6e3
parent4febd59e1bdcbee65f37f18966bb9783dc344efa
[WebAssembly] Emit br_table for most switch instructions

Summary:
Always convert switches to br_tables unless there is only one case,
which is equivalent to a simple branch. This reduces code size for wasm,
and we defer possible jump table optimizations to the VM.
Addresses PR41502.

Reviewers: kripken, sunfish

Subscribers: dschuff, sbc100, jgravelle-google, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60966

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359038 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
test/CodeGen/WebAssembly/cfg-stackify.ll