[PATCH] D38252: [ARM] Fix SJLJ exception handling when manually chosen on a platform where it isn't default

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 28 04:15:30 PDT 2017


mstorsjo updated this revision to Diff 116964.
mstorsjo added a comment.

Reverted most of the logic back to the original form, but added a check of `Options.ExceptionModel` instead (which afaik always is available). If this is set to SjLj, we override `UseSjLjEH`, and if `getMCAsmInfo()` is available we verify that it matches just like before.


https://reviews.llvm.org/D38252

Files:
  lib/Target/ARM/ARMSubtarget.cpp
  test/CodeGen/ARM/sjljehprepare-lower-empty-struct.ll


Index: test/CodeGen/ARM/sjljehprepare-lower-empty-struct.ll
===================================================================
--- test/CodeGen/ARM/sjljehprepare-lower-empty-struct.ll
+++ test/CodeGen/ARM/sjljehprepare-lower-empty-struct.ll
@@ -4,6 +4,7 @@
 ; RUN: llc -mtriple=armv7-apple-ios -O3 < %s | FileCheck %s
 ; RUN: llc -mtriple=armv7-apple-watchos -O3 < %s | FileCheck %s
 ; RUN: llc -mtriple=armv7k-apple-ios < %s | FileCheck %s --check-prefix=CHECK-WATCH
+; RUN: llc -mtriple=armv7-linux -exception-model sjlj -O3 < %s | FileCheck %s --check-prefix=CHECK-LINUX
 
 ; SjLjEHPrepare shouldn't crash when lowering empty structs.
 ;
@@ -17,6 +18,12 @@
 ; CHECK: bl __Unwind_SjLj_Register
 ; CHECK-NEXT: {{[A-Z][a-zA-Z0-9]*}}:
 ; CHECK-NEXT: bl _bar
+; CHECK: bl __Unwind_SjLj_Resume
+
+; CHECK-LINUX: bl _Unwind_SjLj_Register
+; CHECK-LINUX-NEXT: .{{[A-Z][a-zA-Z0-9]*}}:
+; CHECK-LINUX-NEXT: bl bar
+; CHECK-LINUX: bl _Unwind_SjLj_Resume
 
 ; CHECK-WATCH-NOT: bl __Unwind_SjLj_Register
 
Index: lib/Target/ARM/ARMSubtarget.cpp
===================================================================
--- lib/Target/ARM/ARMSubtarget.cpp
+++ lib/Target/ARM/ARMSubtarget.cpp
@@ -151,6 +151,8 @@
   // directly from it, but we can try to make sure they're consistent when both
   // available.
   UseSjLjEH = isTargetDarwin() && !isTargetWatchABI();
+  if (Options.ExceptionModel == ExceptionHandling::SjLj)
+    UseSjLjEH = true;
   assert((!TM.getMCAsmInfo() ||
           (TM.getMCAsmInfo()->getExceptionHandlingType() ==
            ExceptionHandling::SjLj) == UseSjLjEH) &&


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38252.116964.patch
Type: text/x-patch
Size: 1579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170928/b0310264/attachment.bin>


More information about the llvm-commits mailing list