llvm-project/llvm/test
Heejin Ahn 445f4e7484 [WebAssembly] Disable wasm.lsda() optimization in WasmEHPrepare
In every catchpad except `catch (...)`, we add a call to
`_Unwind_CallPersonality`, which is a wapper to call the personality
function. (In most of other Itanium-based architectures the call is done
from libunwind, but in wasm we don't have the control over the VM.)
Because the personatlity function is called to figure out whether the
current exception is a type we should catch, such as `int` or
`SomeClass&`, `catch (...)` does not need the personality function call.
For the same reason, all cleanuppads don't need it.

When we call `_Unwind_CallPersonality`, we store some necessary info in
a data structure called `__wasm_lpad_context` of type
`_Unwind_LandingPadContext`, which is defined  in the wasm's port of
libunwind in Emscripten. Also the personality wrapper function returns
some info (selector and the caught pointer) in that data structure, so
it is used as a medium for communication.

One of the info we need to store is the address for LSDA info for the
current function. `wasm.lsda()` intrinsic returns that address. (This
intrinsic will be lowered to a symbol that points to the LSDA address.)
The simpliest thing is call `wasm.lsda()` every time we need to call
`_Unwind_CallPersonality` and store that info in `__wasm_lpad_context`
data structure. But we tried to be better than that (D77423 and some
more previous CLs), so if catchpad A dominates catchpad B and catchpad A
is not `catch (...)`, we didn't insert `wasm.lsda()` call in catchpad B,
thinking that the LSDA address is the same for a single function and we
already visited catchpad A and `__wasm_lpad_context.lsda` field would
already have that value.

But this can be incorrect if there is a call to another function, which
also can have the personality function and LSDA, between catchpad A and
catchpad B, because `__wasm_lpad_context` is a globally defined
structure and the callee function will overwrite its `lsda` field.

So in this CL we don't try to do any optimizaions on adding
`wasm.lsda()` call; we store the result of `wasm.lsda()` every time we
call `_Unwind_CallPersonality`. We can do some complicated analysis,
like checking if there is a function call between the dominating
catchpad and the current catchpad, but at this time it seems overkill.

This deletes three tests because they all tested `wasm.ldsa()` call
optimization.

Fixes https://github.com/emscripten-core/emscripten/issues/13548.

Reviewed By: tlively

Differential Revision: https://reviews.llvm.org/D97309
2021-02-23 14:38:59 -08:00
..
Analysis [TTI] Change getOperandsScalarizationOverhead to take Type args 2021-02-23 13:04:59 +00:00
Assembler [LTO] Perform DSOLocal propagation in combined index 2021-02-12 22:58:26 -08:00
Bindings LLVM-C: Allow LLVM{Get/Set}Alignment on an atomicrmw/cmpxchg instruction. 2021-02-12 18:31:18 -05:00
Bitcode Add auto-upgrade support for annotation intrinsics 2021-02-22 15:42:16 -08:00
BugPoint
CodeGen [WebAssembly] Disable wasm.lsda() optimization in WasmEHPrepare 2021-02-23 14:38:59 -08:00
DebugInfo [CodeGen] Fix two dots between text section name and symbol name 2021-02-20 10:15:48 +08:00
Demangle [Demangle] Support demangling Swift calling convention in MS demangler. 2021-01-27 13:24:54 -08:00
Examples [test][NewPM] Pin various tests to the legacy PM 2021-02-02 15:07:10 -08:00
ExecutionEngine Revert "[JITLink] Add missing symbols for ELF ehframe testcase, re-enable ...." 2021-02-01 13:32:11 +11:00
Feature [DCE] Don't remove non-willreturn calls 2021-02-19 12:35:40 +01:00
FileCheck [FileCheck] Default --allow-unused-prefixes to false 2021-02-08 13:37:04 -08:00
Instrumentation [dfsan] Propagate origins at non-memory/phi/call instructions 2021-02-23 02:12:45 +00:00
Integer
JitListener
LTO [DCE] Don't remove non-willreturn calls 2021-02-19 12:35:40 +01:00
Linker [llvm-link] fix IRMover returning wrong modified vector type 2021-02-22 11:29:42 +00:00
MC [THUMB2] add .w suffixes for ldr/str (immediate) T4 2021-02-23 09:25:40 -08:00
MachineVerifier [GlobalISel] Add G_ASSERT_SEXT 2021-02-17 13:10:34 -08:00
Object [AMDGPU] gfx90a support 2021-02-17 16:01:32 -08:00
ObjectYAML [yaml2obj][wasm] Support numeric relocation type 2021-02-02 18:28:37 -08:00
Other Reland "[Libcalls, Attrs] Annotate libcalls with noundef" 2021-02-20 06:18:48 +01:00
Reduce [FileCheck] Default --allow-unused-prefixes to false 2021-02-08 13:37:04 -08:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen [TableGen][SelectionDAG] Improve efficiency of encoding negative immediates for isel's CheckInteger opcode. 2021-02-18 08:53:17 -08:00
ThinLTO/X86 [ThinLTO] Fix import of multiply defined global variables 2021-02-21 18:34:12 +02:00
Transforms [llvm-profdata] Emit Error when Invalid MemOpSize Section is Created by llvm-profdata 2021-02-23 12:51:54 -08:00
Unit Support multi-configuration generators correctly in several config files 2021-02-11 09:32:20 -08:00
Verifier [IR] restrict vector reduction intrinsic types 2021-02-21 12:37:00 -05:00
YAMLParser
tools [llvm-profdata] Emit Error when Invalid MemOpSize Section is Created by llvm-profdata 2021-02-23 12:51:54 -08:00
.clang-format
CMakeLists.txt Support multi-configuration generators correctly in several config files 2021-02-11 09:32:20 -08:00
TestRunner.sh
lit.cfg.py [FileCheck] Default --allow-unused-prefixes to false 2021-02-08 13:37:04 -08:00
lit.site.cfg.py.in Support multi-configuration generators correctly in several config files 2021-02-11 09:32:20 -08:00