[WebAssembly] Fix bug in FixBrTables and use branch analysis utils
authorThomas Lively <tlively@google.com>
Wed, 17 Jun 2020 19:34:45 +0000 (12:34 -0700)
committerThomas Lively <tlively@google.com>
Wed, 17 Jun 2020 19:34:45 +0000 (12:34 -0700)
commit49754dcf22127b236892e4e46945e951bf790c44
treed032f4e555a5089f60483d008930b3583a80fa42
parent37e54ffa50595b7d7e8a00a758011dc184ebdea9
[WebAssembly] Fix bug in FixBrTables and use branch analysis utils

Summary:
This commit fixes a bug in the FixBrTables pass in which an
unconditional branch from the switch header block to the jump table
block was not removed before the blocks were combined. The result was
an invalid CFG in the MachineFunction. This commit also switches from
using bespoke branch analysis and deletion code to using the standard
utilities for the same.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81909
llvm/lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp
llvm/test/CodeGen/WebAssembly/switch-unreachable-default.ll