diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2015-02-23 20:01:56 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2015-02-23 20:01:56 +0000 |
commit | f22fe4ae18ceef69a0c54286fdfe626ee80099f9 (patch) | |
tree | a5e004ac6a7cb0046ea4a9a46948019ca291b085 /llvm/test/CodeGen/X86/cppeh-catch-all.ll | |
parent | 32173cdf06a92408a8e1cc3ad7b582fe7cc46c6a (diff) | |
download | bcm5719-llvm-f22fe4ae18ceef69a0c54286fdfe626ee80099f9.tar.gz bcm5719-llvm-f22fe4ae18ceef69a0c54286fdfe626ee80099f9.zip |
Remap frame variables for native Windows exception handling.
Differential Revision: http://reviews.llvm.org/D7770
llvm-svn: 230249
Diffstat (limited to 'llvm/test/CodeGen/X86/cppeh-catch-all.ll')
-rw-r--r-- | llvm/test/CodeGen/X86/cppeh-catch-all.ll | 166 |
1 files changed, 83 insertions, 83 deletions
diff --git a/llvm/test/CodeGen/X86/cppeh-catch-all.ll b/llvm/test/CodeGen/X86/cppeh-catch-all.ll index fd8c2f85885..9d3373cebf5 100644 --- a/llvm/test/CodeGen/X86/cppeh-catch-all.ll +++ b/llvm/test/CodeGen/X86/cppeh-catch-all.ll @@ -1,83 +1,83 @@ -; RUN: opt -mtriple=x86_64-pc-windows-msvc -winehprepare -S -o - < %s | FileCheck %s - -; This test is based on the following code: -; -; void test() -; { -; try { -; may_throw(); -; } catch (...) { -; handle_exception(); -; } -; } -; -; Parts of the IR have been hand-edited to simplify the test case. -; The full IR will be restored when Windows C++ EH support is complete. - -; ModuleID = 'catch-all.cpp' -target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" -target triple = "x86_64-pc-windows-msvc" - -; Function Attrs: uwtable -define void @_Z4testv() #0 { -entry: - %exn.slot = alloca i8* - %ehselector.slot = alloca i32 - invoke void @_Z9may_throwv() - to label %invoke.cont unwind label %lpad - -invoke.cont: ; preds = %entry - br label %try.cont - -lpad: ; preds = %entry - %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) - catch i8* null - %1 = extractvalue { i8*, i32 } %0, 0 - store i8* %1, i8** %exn.slot - %2 = extractvalue { i8*, i32 } %0, 1 - store i32 %2, i32* %ehselector.slot - br label %catch - -catch: ; preds = %lpad - %exn = load i8** %exn.slot - %3 = call i8* @llvm.eh.begincatch(i8* %exn) #3 - call void @_Z16handle_exceptionv() - br label %invoke.cont2 - -invoke.cont2: ; preds = %catch - call void @llvm.eh.endcatch() - br label %try.cont - -try.cont: ; preds = %invoke.cont2, %invoke.cont - ret void -} - -; CHECK: define i8* @_Z4testv.catch(i8*, i8*) { -; CHECK: catch.entry: -; CHECK: %eh.alloc = call i8* @llvm.framerecover(i8* bitcast (void ()* @_Z4testv to i8*), i8* %1) -; CHECK: %ehdata = bitcast i8* %eh.alloc to %struct._Z4testv.ehdata* -; CHECK: %eh.obj.ptr = getelementptr inbounds %struct._Z4testv.ehdata* %ehdata, i32 0, i32 1 -; CHECK: %eh.obj = load i8** %eh.obj.ptr -; CHECK: call void @_Z16handle_exceptionv() -; CHECK: ret i8* blockaddress(@_Z4testv, %try.cont) -; CHECK: } - -declare void @_Z9may_throwv() #1 - -declare i32 @__CxxFrameHandler3(...) - -declare i8* @llvm.eh.begincatch(i8*) - -declare void @_Z16handle_exceptionv() #1 - -declare void @llvm.eh.endcatch() - -attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #2 = { noinline noreturn nounwind } -attributes #3 = { nounwind } -attributes #4 = { noreturn nounwind } - -!llvm.ident = !{!0} - -!0 = !{!"clang version 3.7.0 (trunk 226027)"} +; RUN: opt -mtriple=x86_64-pc-windows-msvc -winehprepare -S -o - < %s | FileCheck %s
+
+; This test is based on the following code:
+;
+; void test()
+; {
+; try {
+; may_throw();
+; } catch (...) {
+; handle_exception();
+; }
+; }
+;
+; Parts of the IR have been hand-edited to simplify the test case.
+; The full IR will be restored when Windows C++ EH support is complete.
+
+; ModuleID = 'catch-all.cpp'
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-pc-windows-msvc"
+
+; Function Attrs: uwtable
+define void @_Z4testv() #0 {
+entry:
+ %exn.slot = alloca i8*
+ %ehselector.slot = alloca i32
+ invoke void @_Z9may_throwv()
+ to label %invoke.cont unwind label %lpad
+
+invoke.cont: ; preds = %entry
+ br label %try.cont
+
+lpad: ; preds = %entry
+ %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
+ catch i8* null
+ %1 = extractvalue { i8*, i32 } %0, 0
+ store i8* %1, i8** %exn.slot
+ %2 = extractvalue { i8*, i32 } %0, 1
+ store i32 %2, i32* %ehselector.slot
+ br label %catch
+
+catch: ; preds = %lpad
+ %exn = load i8** %exn.slot
+ %3 = call i8* @llvm.eh.begincatch(i8* %exn) #3
+ call void @_Z16handle_exceptionv()
+ br label %invoke.cont2
+
+invoke.cont2: ; preds = %catch
+ call void @llvm.eh.endcatch()
+ br label %try.cont
+
+try.cont: ; preds = %invoke.cont2, %invoke.cont
+ ret void
+}
+
+; CHECK: define i8* @_Z4testv.catch(i8*, i8*) {
+; CHECK: catch.entry:
+; CHECK: %eh.alloc = call i8* @llvm.framerecover(i8* bitcast (void ()* @_Z4testv to i8*), i8* %1)
+; CHECK: %eh.data = bitcast i8* %eh.alloc to %struct._Z4testv.ehdata*
+; CHECK: %eh.obj.ptr = getelementptr inbounds %struct._Z4testv.ehdata* %eh.data, i32 0, i32 1
+; CHECK: %eh.obj = load i8** %eh.obj.ptr
+; CHECK: call void @_Z16handle_exceptionv()
+; CHECK: ret i8* blockaddress(@_Z4testv, %try.cont)
+; CHECK: }
+
+declare void @_Z9may_throwv() #1
+
+declare i32 @__CxxFrameHandler3(...)
+
+declare i8* @llvm.eh.begincatch(i8*)
+
+declare void @_Z16handle_exceptionv() #1
+
+declare void @llvm.eh.endcatch()
+
+attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #2 = { noinline noreturn nounwind }
+attributes #3 = { nounwind }
+attributes #4 = { noreturn nounwind }
+
+!llvm.ident = !{!0}
+
+!0 = !{!"clang version 3.7.0 (trunk 226027)"}
|