aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorHeejin Ahn <aheejin@gmail.com>2020-09-06 10:36:07 -0700
committerHeejin Ahn <aheejin@gmail.com>2020-09-08 09:27:40 -0700
commitd25c17f3175b344420c1f30040b206a47a512c9d (patch)
tree5da49f57cc9bc7e3d1ea3ffa51c29bf5ce59f398 /clang/lib/Frontend/CompilerInvocation.cpp
parent3c83b967cf223ce6a2e0813e48b64f7689512f20 (diff)
downloadllvm-d25c17f3175b344420c1f30040b206a47a512c9d.zip
llvm-d25c17f3175b344420c1f30040b206a47a512c9d.tar.gz
llvm-d25c17f3175b344420c1f30040b206a47a512c9d.tar.bz2
[WebAssembly] Fix fixEndsAtEndOfFunction for try-catch
When the function return type is non-void and `end` instructions are at the very end of a function, CFGStackify's `fixEndsAtEndOfFunction` function fixes the corresponding block/loop/try's type to match the function's return type. This is applied to consecutive `end` markers at the end of a function. For example, when the function return type is `i32`, ``` block i32 ;; return type is fixed to i32 ... loop i32 ;; return type is fixed to i32 ... end_loop end_block end_function ``` But try-catch is a little different, because it consists of two parts: a try part and a catch part, and both parts' return type should satisfy the function's return type. Which means, ``` try i32 ;; return type is fixed to i32 ... block i32 ;; this should be changed i32 too! ... end_block catch ... end_try end_function ``` As you can see in this example, it is not sufficient to only `end` instructions at the end of a function; in case of `try`, we should check instructions before `catch`es, in case their corresponding `try`'s type has been fixed. This changes `fixEndsAtEndOfFunction`'s algorithm to use a worklist that contains a reverse iterator, each of which is a starting point for a new backward `end` instruction search. Fixes https://bugs.llvm.org/show_bug.cgi?id=47413. Reviewed By: dschuff, tlively Differential Revision: https://reviews.llvm.org/D87207
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions