[EH] Recognize __(gxx|gcc)_personality_seh0 as the GNU EH personalities

These are no-ops when there are no invokes. We don't need to emit LSDAs
for them.

Fixes PR33220.

llvm-svn: 304367
This commit is contained in:
Reid Kleckner 2017-05-31 22:35:52 +00:00
parent 605f779516
commit fc7ba565ed
2 changed files with 36 additions and 0 deletions

View File

@ -27,8 +27,10 @@ EHPersonality llvm::classifyEHPersonality(const Value *Pers) {
return StringSwitch<EHPersonality>(F->getName())
.Case("__gnat_eh_personality", EHPersonality::GNU_Ada)
.Case("__gxx_personality_v0", EHPersonality::GNU_CXX)
.Case("__gxx_personality_seh0",EHPersonality::GNU_CXX)
.Case("__gxx_personality_sj0", EHPersonality::GNU_CXX_SjLj)
.Case("__gcc_personality_v0", EHPersonality::GNU_C)
.Case("__gcc_personality_seh0",EHPersonality::GNU_C)
.Case("__gcc_personality_sj0", EHPersonality::GNU_C_SjLj)
.Case("__objc_personality_v0", EHPersonality::GNU_ObjC)
.Case("_except_handler3", EHPersonality::MSVC_X86SEH)

View File

@ -0,0 +1,34 @@
; RUN: llc -mtriple=x86_64-windows-gnu < %s | FileCheck %s
declare void @throwit()
declare void @__gxx_personality_seh0(...)
declare void @__gcc_personality_seh0(...)
define void @use_gxx_seh()
personality void (...)* @__gxx_personality_seh0 {
entry:
call void @throwit()
unreachable
}
; CHECK-LABEL: use_gxx_seh:
; CHECK: .seh_proc use_gxx_seh
; CHECK-NOT: .seh_handler __gxx_personality_seh0
; CHECK: callq throwit
; CHECK: .seh_handlerdata
; CHECK: .seh_endproc
define void @use_gcc_seh()
personality void (...)* @__gcc_personality_seh0 {
entry:
call void @throwit()
unreachable
}
; CHECK-LABEL: use_gcc_seh:
; CHECK: .seh_proc use_gcc_seh
; CHECK-NOT: .seh_handler __gcc_personality_seh0
; CHECK: callq throwit
; CHECK: .seh_handlerdata
; CHECK: .seh_endproc