[all-commits] [llvm/llvm-project] aa097e: [WebAssembly] Fix reverse mapping in WasmEHFuncInfo

Heejin Ahn via All-commits all-commits at lists.llvm.org
Fri Feb 26 17:13:41 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aa097ef8d474c925e4fbe0efcaad253266c2fd6f
      https://github.com/llvm/llvm-project/commit/aa097ef8d474c925e4fbe0efcaad253266c2fd6f
  Author: Heejin Ahn <aheejin at gmail.com>
  Date:   2021-02-26 (Fri, 26 Feb 2021)

  Changed paths:
    M llvm/include/llvm/CodeGen/WasmEHFuncInfo.h
    M llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
    M llvm/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp
    M llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll

  Log Message:
  -----------
  [WebAssembly] Fix reverse mapping in WasmEHFuncInfo

D97247 added the reverse mapping from unwind destination to their
source, but it had a critical bug; sources can be multiple, because
multiple BBs can have a single BB as their unwind destination.

This changes `WasmEHFuncInfo::getUnwindSrc` to `getUnwindSrcs` and makes
it return a vector rather than a single BB. It does not return the const
reference to the existing vector but creates a new vector because
`WasmEHFuncInfo` stores not `BasicBlock*` or `MachineBasicBlock*` but
`PointerUnion` of them. Also I hoped to unify those methods for
`BasicBlock` and `MachineBasicBlock` into one using templates to reduce
duplication, but failed because various usages require `BasicBlock*` to
be `const` but it's hard to make it `const` for `MachineBasicBlock`
usages.

Fixes https://github.com/emscripten-core/emscripten/issues/13514.
(More precisely, fixes
https://github.com/emscripten-core/emscripten/issues/13514#issuecomment-784708744)

Reviewed By: dschuff, tlively

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




More information about the All-commits mailing list