llvm-6502/test/CodeGen/WinEH/cppeh-shared-empty-catch.ll
Reid Kleckner 8f32e5f0d6 Rename llvm.frameescape and llvm.framerecover to localescape and localrecover
Summary:
Initially, these intrinsics seemed like part of a family of "frame"
related intrinsics, but now I think that's more confusing than helpful.
Initially, the LangRef specified that this would create a new kind of
allocation that would be allocated at a fixed offset from the frame
pointer (EBP/RBP). We ended up dropping that design, and leaving the
stack frame layout alone.

These intrinsics are really about sharing local stack allocations, not
frame pointers. I intend to go further and add an `llvm.localaddress()`
intrinsic that returns whatever register (EBP, ESI, ESP, RBX) is being
used to address locals, which should not be confused with the frame
pointer.

Naming suggestions at this point are welcome, I'm happy to re-run sed.

Reviewers: majnemer, nicholas

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D11011

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241633 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-07 22:25:32 +00:00

111 lines
4.0 KiB
LLVM

; RUN: opt -mtriple=x86_64-pc-windows-msvc -winehprepare -S -o - < %s | FileCheck %s
; This test is based on the following source, built with -O2
;
; void f() {
; try {
; g();
; try {
; throw;
; } catch (int) {
; }
; } catch (...) {
; }
; }
;
; ModuleID = '<stdin>'
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
%eh.CatchHandlerType = type { i32, i8* }
%eh.ThrowInfo = type { i32, i32, i32, i32 }
$"\01??_R0H@8" = comdat any
@"\01??_7type_info@@6B@" = external constant i8*
@"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
@llvm.eh.handlertype.H.0 = private unnamed_addr constant %eh.CatchHandlerType { i32 0, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*) }, section "llvm.metadata"
; CHECK-LABEL: define void @"\01?f@@YAXXZ"()
; CHECK: entry:
; CHECK: call void (...) @llvm.localescape()
; CHECK: invoke void @"\01?g@@YAXXZ"()
; Function Attrs: nounwind
define void @"\01?f@@YAXXZ"() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
entry:
invoke void @"\01?g@@YAXXZ"()
to label %invoke.cont unwind label %lpad
; CHECK-LABEL: invoke.cont:
; CHECK: invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null)
; CHECK: to label %unreachable unwind label %[[LPAD1_LABEL:lpad[0-9]+]]
invoke.cont: ; preds = %entry
invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #4
to label %unreachable unwind label %lpad1
lpad: ; preds = %entry
%0 = landingpad { i8*, i32 }
catch i8* null
%1 = extractvalue { i8*, i32 } %0, 0
br label %catch2
; Note: Even though this landing pad has two catch clauses, it only has one action because both
; handlers do the same thing.
; CHECK: [[LPAD1_LABEL]]:
; CHECK: landingpad { i8*, i32 }
; CHECK-NEXT: catch %eh.CatchHandlerType* @llvm.eh.handlertype.H.0
; CHECK-NEXT: catch i8* null
; CHECK-NEXT: [[RECOVER:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* null, i32 -1, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch")
; CHECK-NEXT: indirectbr i8* [[RECOVER]], [label %try.cont4]
lpad1: ; preds = %invoke.cont
%2 = landingpad { i8*, i32 }
catch %eh.CatchHandlerType* @llvm.eh.handlertype.H.0
catch i8* null
%3 = extractvalue { i8*, i32 } %2, 0
br label %catch2
catch2: ; preds = %lpad1, %lpad
%exn.slot.0 = phi i8* [ %3, %lpad1 ], [ %1, %lpad ]
tail call void @llvm.eh.begincatch(i8* %exn.slot.0, i8* null) #3
tail call void @llvm.eh.endcatch() #3
br label %try.cont4
try.cont4: ; preds = %catch, %catch2
ret void
unreachable: ; preds = %invoke.cont
unreachable
; CHECK: }
}
declare void @"\01?g@@YAXXZ"() #1
declare i32 @__CxxFrameHandler3(...)
declare void @_CxxThrowException(i8*, %eh.ThrowInfo*)
; Function Attrs: nounwind readnone
declare i32 @llvm.eh.typeid.for(i8*) #2
; Function Attrs: nounwind
declare void @llvm.eh.begincatch(i8* nocapture, i8* nocapture) #3
; Function Attrs: nounwind
declare void @llvm.eh.endcatch() #3
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind readnone }
attributes #3 = { nounwind }
attributes #4 = { noreturn }
!llvm.ident = !{!0}
!0 = !{!"clang version 3.7.0 (trunk 235112) (llvm/trunk 235121)"}