[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
Mon Sep 25 13:00:53 PDT 2017
mstorsjo created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.
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
@@ -148,13 +148,11 @@
void ARMSubtarget::initializeEnvironment() {
// MCAsmInfo isn't always present (e.g. in opt) so we can't initialize this
- // directly from it, but we can try to make sure they're consistent when both
- // available.
+ // directly from it, but if present, we should use it since the type can be
+ // overridden by the user.
UseSjLjEH = isTargetDarwin() && !isTargetWatchABI();
- assert((!TM.getMCAsmInfo() ||
- (TM.getMCAsmInfo()->getExceptionHandlingType() ==
- ExceptionHandling::SjLj) == UseSjLjEH) &&
- "inconsistent sjlj choice between CodeGen and MC");
+ if (TM.getMCAsmInfo())
+ UseSjLjEH = TM.getMCAsmInfo()->getExceptionHandlingType() == ExceptionHandling::SjLj;
}
void ARMSubtarget::initSubtargetFeatures(StringRef CPU, StringRef FS) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38252.116596.patch
Type: text/x-patch
Size: 1993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170925/b21fbbf8/attachment.bin>
More information about the llvm-commits
mailing list