[all-commits] [llvm/llvm-project] d8b3dc: [WebAssembly] Fix remapping branch dests in fixCat...

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


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

  Changed paths:
    M llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
    M llvm/test/CodeGen/WebAssembly/cfg-stackify-eh.ll

  Log Message:
  -----------
  [WebAssembly] Fix remapping branch dests in fixCatchUnwindMismatches

This is a case D97178 tried to solve but missed. D97178 could not handle
the case when
multiple consecutive delegates are generated:
- Before:
```
block
  br (a)
  try
  catch
  end_try
end_block
          <- (a)
```

- After
```
block
  br (a)
  try
    ...
    try
      try
      catch
      end_try
            <- (a)
    delegate
  delegate
end_block
          <- (b)
```
(The `br` should point to (b) now)

D97178 assumed `end_block` exists two BBs later than `end_try`, because
it assumed the order as `end_try` BB -> `delegate` BB -> `end_block` BB.
But it turned out there can be multiple `delegate`s in between. This
patch changes the logic so we just search from `end_try` BB until we
find `end_block`.

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

Reviewed By: dschuff, tlively

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




More information about the All-commits mailing list