[PATCH] D80863: [WebAssembly] Eliminate range checks on br_tables

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 30 01:01:39 PDT 2020


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

Jump tables for most targets cannot handle out of range indices by
themselves, so LLVM emits range checks to guard the jump
tables. WebAssembly, on the other hand, implements jump tables using
the br_table instruction, which takes a default branch target as an
operand, making the range checks redundant. This patch introduces a
new MachineFunction pass in the WebAssembly backend to find and
eliminate the redundant range checks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80863

Files:
  llvm/lib/Target/WebAssembly/CMakeLists.txt
  llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
  llvm/lib/Target/WebAssembly/WebAssembly.h
  llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
  llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  llvm/test/CodeGen/WebAssembly/cfg-stackify.ll
  llvm/test/CodeGen/WebAssembly/indirectbr.ll
  llvm/test/CodeGen/WebAssembly/stack-insts.ll
  llvm/test/CodeGen/WebAssembly/switch.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80863.267444.patch
Type: text/x-patch
Size: 13795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200530/9bd9792e/attachment.bin>


More information about the llvm-commits mailing list