]> granicus.if.org Git - llvm/commitdiff
[WebAssembly] Add missing -mattr=+exception-handling guards
authorHeejin Ahn <aheejin@gmail.com>
Wed, 18 Jul 2018 21:42:22 +0000 (21:42 +0000)
committerHeejin Ahn <aheejin@gmail.com>
Wed, 18 Jul 2018 21:42:22 +0000 (21:42 +0000)
Summary:
The use of exception handling instructions should only be enabled with
`-mattr=+exception-handling` option.

Reviewers: jgravelle-google

Subscribers: dschuff, sbc100, sunfish, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337425 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyInstrControl.td
test/CodeGen/WebAssembly/exception.ll

index 09e148fb50d00db82863d499412652f7a283be06..d90244b90662cbc0f25bb6b16a2d6698561a6fde 100644 (file)
@@ -140,6 +140,8 @@ defm UNREACHABLE : NRI<(outs), (ins), [(trap)], "unreachable", 0x00>;
 // Exception handling instructions
 //===----------------------------------------------------------------------===//
 
+let Predicates = [HasExceptionHandling] in {
+
 // Throwing an exception: throw / rethrow
 let isTerminator = 1, hasCtrlDep = 1, isBarrier = 1 in {
 defm THROW_I32 : I<(outs), (ins i32imm:$tag, I32:$val),
@@ -187,5 +189,6 @@ let isTerminator = 1, hasSideEffects = 1, isBarrier = 1, hasCtrlDep = 1,
   defm CATCHRET : NRI<(outs), (ins bb_op:$dst, bb_op:$from),
                    [(catchret bb:$dst, bb:$from)], "", 0>;
 }
+}
 
 } // Defs = [ARGUMENTS]
index aab054a3a849ee6bf98d551bd136bbd1a388bfd7..bab8de24f73bcb35dc6ba470c4ab8d5b068c8e29 100644 (file)
@@ -1,4 +1,5 @@
-; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -exception-model=wasm | FileCheck -allow-deprecated-dag-overlap %s
+; RUN: not llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -exception-model=wasm
+; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -exception-model=wasm -mattr=+exception-handling | FileCheck -allow-deprecated-dag-overlap %s
 
 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
 target triple = "wasm32-unknown-unknown"