1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/WebAssembly
Heejin Ahn 9b48b7e7be [WebAssembly] Make Emscripten EH work with Emscripten SjLj
When Emscripten EH mixes with Emscripten SjLj, we are not currently
handling some of them correctly. There are three cases:
1. The current function calls `setjmp` and there is an `invoke` to a
   function that can either throw or longjmp. In this case, we have to
   check both for exception and longjmp. We are currently handling this
   case correctly:
   0c0eb76782/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (L1058-L1090)
   When inserting routines for functions that can longjmp, which we do
   only for setjmp-calling functions, we check if the function was
   previously an `invoke` and handle it correctly.

2. The current function does NOT call `setjmp` and there is an `invoke`
   to a function that can either throw or longjmp. Because there is no
   `setjmp` call, we haven't been doing any check for functions that can
   longjmp. But in that case, for `invoke`, we only check for an
   exception and if it is not an exception we reset `__THREW__` to 0,
   which can silently swallow the longjmp:
   0c0eb76782/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (L70-L80)
   This CL fixes this.

3. The current function calls `setjmp` and there is no `invoke`. Because
   it is not an `invoke`, we haven't been doing any check for functions
   that can throw, and only insert longjmp-checking routines for
   functions that can longjmp. But in that case, if a longjmpable
   function throws, we only check for a longjmp so if it is not a
   longjmp we reset `__THREW__` to 0, which can silently swallow the
   exception:
   0c0eb76782/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (L156-L169)
   This CL fixes this.

To do that, this moves around some code, so we register necessary
functions for both EH and SjLj and precompute some data (the set of
functions that contains `setjmp`) before doing actual EH or SjLj
transformation.

This CL makes 2nd and 3rd tests in
https://github.com/emscripten-core/emscripten/pull/14732 work.

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D106525
2021-07-26 13:48:31 -07:00
..
add-prototypes-conflict.ll [OpaquePtr] Support forward references in textual IR 2021-06-29 20:10:31 +02:00
add-prototypes.ll
address-offsets.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
aliases.ll
atomic-fence.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
atomic-fence.mir [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
atomic-mem-consistency.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
atomic-pic.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
atomic-rmw.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
bulk-memory64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
bulk-memory.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
byval.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
call-indirect.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
call-pic.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
call.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
cfg-stackify-dbg-skip.ll
cfg-stackify-dbg.mir
cfg-stackify-eh.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
cfg-stackify-eh.mir [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
cfg-stackify.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
cfi.ll
clear-cache.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
comparisons-f32.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
comparisons-f64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
comparisons-i32.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
comparisons-i64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
conv-trap.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
conv.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
copysign-casts.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
cpus.ll
custom-sections.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
dbgvalue.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
dead-vreg.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
debugtest-opt.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
debugtrap.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
divrem-constant.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
eh-lsda.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
exception.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
exception.mir [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
explicit-locals.mir
export-name.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
externref-globalget.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
externref-globalset.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
externref-inttoptr.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
externref-ptrtoint.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
externref-undef.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
externref-unsized-load.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
externref-unsized-store.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
f16.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
f32.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
f64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fast-isel-br-i1.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fast-isel-call-indirect64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fast-isel-i24.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fast-isel-i256.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fast-isel-noreg.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fast-isel-pr47040.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fast-isel.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
frem.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
fshl.ll
func.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
funcref-call.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
funcref-globalget.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
funcref-globalset.ll [WebAssembly] Implementation of global.get/set for reftypes in LLVM IR 2021-07-22 22:07:24 +02:00
function-bitcasts-varargs.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
function-bitcasts.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
function-info.mir [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
function-pointer64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
global_dtors.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
global-get.ll [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
global-set.ll
global.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
globl.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
i32-load-store-alignment.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
i32.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
i64-load-store-alignment.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
i64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
i128-returned.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
i128.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
ident.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
immediates.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
implicit-def.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
import-module.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
indirect-import.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
indirectbr.ll
inline-asm-m.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
inline-asm-roundtrip.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
inline-asm.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
inlineasm-output-template.ll
ir-locals-stackid.ll
ir-locals.ll
irreducible-cfg-exceptions.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
irreducible-cfg.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
irreducible-cfg.mir [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
legalize.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
libcalls.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
lit.local.cfg
llround-conv-i32.ll
load-ext-atomic.ll
load-ext.ll
load-store-i1.ll
load-store-pic.ll [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
load-store-static.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
load.ll
lower-em-ehsjlj-multi-return.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
lower-em-ehsjlj-options.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
lower-em-ehsjlj.ll [WebAssembly] Make Emscripten EH work with Emscripten SjLj 2021-07-26 13:48:31 -07:00
lower-em-exceptions-allowed.ll
lower-em-exceptions-resume-only.ll
lower-em-exceptions.ll
lower-em-sjlj-alias.ll
lower-em-sjlj-debuginfo.ll
lower-em-sjlj-sret.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
lower-em-sjlj.ll [WebAssembly] Make Emscripten EH work with Emscripten SjLj 2021-07-26 13:48:31 -07:00
lower-global-dtors.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
main-declaration.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
main-no-args.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
main-three-args.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
main-with-args.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
masked-shifts.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
mem-intrinsics.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
memory-addr32.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
memory-addr64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
muloti4.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
multi-return.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
multivalue-stackify.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
multivalue-stackify.py [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
multivalue.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
mutable-globals.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
negative-base-reg.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
null-streamer.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
offset-atomics.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
offset-fastisel.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
offset-folding.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
offset.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
phi.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
pr47375.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
PR40172.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
PR40267.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
PR41149.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
PR41841.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
reference-types.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
reg-argument.mir
reg-copy.mir
reg-stackify.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
return-address-emscripten.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
return-address-unknown.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
return-int32.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
return-void.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
returned.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
select.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
signext-arg.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
signext-inreg.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
signext-zeroext.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-arith.ll [WebAssembly] Codegen for pmin and pmax 2021-07-23 14:49:21 -07:00
simd-bitcasts.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-build-pair.ll [WebAssembly] Codegen for v128.storeX_lane instructions 2021-07-14 16:15:25 -07:00
simd-build-vector.ll [WebAssembly] Codegen for v128.loadX_lane instructions 2021-07-14 11:31:53 -07:00
simd-comparisons.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-concat.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-conversions.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-extended-extract.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-extending.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-illegal-signext.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-intrinsics.ll [WebAssembly] Codegen for pmin and pmax 2021-07-23 14:49:21 -07:00
simd-load-lane-offset.ll [WebAssembly] Codegen for v128.storeX_lane instructions 2021-07-14 16:15:25 -07:00
simd-load-splat.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-load-store-alignment.ll [WebAssembly] Codegen for v128.load{32,64}_zero 2021-07-21 09:02:12 -07:00
simd-load-zero-offset.ll [WebAssembly] Codegen for v128.load{32,64}_zero 2021-07-21 09:02:12 -07:00
simd-nested-shuffles.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-nonconst-sext.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-offset.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-reductions.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-scalar-to-vector.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-select.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-sext-inreg.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-shift-complex-splats.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-shuffle-bitcast.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
simd-unsupported.ll [WebAssembly] Replace @llvm.wasm.popcnt with @llvm.ctpop.v16i8 2021-07-21 16:45:54 -07:00
simd.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
snan_literal.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
stack-alignment.ll
stack-insts.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
stack-protector.ll
stackified-debug.ll
store-trunc-atomic.ll
store-trunc.ll
store.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
swiftcc.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
switch-in-loop.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
switch-unreachable-default.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
switch.ll
tailcall.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
target-features-tls.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
target-features.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
tls-general-dynamic.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
tls-local-exec.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
umulo-128-legalisation-lowering.ll
umulo-i64.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
unreachable.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
unsupported-function-bitcasts.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
unused-argument.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
userstack.ll [WebAssembly] Added initial type checker to MC Assembler 2021-07-09 14:07:25 -07:00
varargs.ll [WebAssembly] Run varargs codegen test with non-emscripten triple 2021-07-13 14:31:19 -07:00
vector-sdiv.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
vtable.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00
wasmehprepare.ll
weak.ll [WebAssembly] Remove datalayout strings from llc tests 2021-07-14 11:17:08 -07:00