summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2019-04-23 21:30:30 +0000
committerHeejin Ahn <aheejin@gmail.com>2019-04-23 21:30:30 +0000
commitb9f282d384fc9b94734ffdf5e505b772a889b214 (patch)
tree5e746f5fd877a49ba60356da4cf061a2f4986491 /llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
parenta746f2b73c39c2043cb75cd4210f87c2b3e347cc (diff)
downloadbcm5719-llvm-b9f282d384fc9b94734ffdf5e505b772a889b214.tar.gz
bcm5719-llvm-b9f282d384fc9b94734ffdf5e505b772a889b214.zip
[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 llvm-svn: 359038
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 7bad4972c4f..105b1360ac2 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -270,6 +270,11 @@ WebAssemblyTargetLowering::WebAssemblyTargetLowering(
MaxStoresPerMemset = 1;
MaxStoresPerMemsetOptSize = 1;
}
+
+ // 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.
+ setMinimumJumpTableEntries(2);
}
TargetLowering::AtomicExpansionKind
OpenPOWER on IntegriCloud