summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/exceptions-seh.c
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-01-30 22:16:45 +0000
committerReid Kleckner <reid@kleckner.net>2015-01-30 22:16:45 +0000
commit3a417c301bc88de5c9d7db2fca7de58f5273c15d (patch)
tree530d70a2d320d726587abdced037c6f0acd087a6 /clang/test/CodeGen/exceptions-seh.c
parentd77bbab393005193fc36153793f65d1279c5b316 (diff)
downloadbcm5719-llvm-3a417c301bc88de5c9d7db2fca7de58f5273c15d.tar.gz
bcm5719-llvm-3a417c301bc88de5c9d7db2fca7de58f5273c15d.zip
SEH: Don't jump to an unreachable continuation block
If both the __try and __except blocks do not return, we want to delete the continuation block as unreachable instead. llvm-svn: 227627
Diffstat (limited to 'clang/test/CodeGen/exceptions-seh.c')
-rw-r--r--clang/test/CodeGen/exceptions-seh.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/clang/test/CodeGen/exceptions-seh.c b/clang/test/CodeGen/exceptions-seh.c
index bba5eac36c5..07b43c6f108 100644
--- a/clang/test/CodeGen/exceptions-seh.c
+++ b/clang/test/CodeGen/exceptions-seh.c
@@ -38,7 +38,7 @@ int safe_div(int numerator, int denominator, int *res) {
void j(void);
// FIXME: Implement local variable captures in filter expressions.
-int filter_expr_capture() {
+int filter_expr_capture(void) {
int r = 42;
__try {
j();
@@ -65,7 +65,7 @@ int filter_expr_capture() {
// FIXMECHECK: store i32 -1, i32* %{{.*}}
// CHECK: ret i32 -1
-int nested_try() {
+int nested_try(void) {
int r = 42;
__try {
__try {
@@ -121,7 +121,7 @@ int nested_try() {
// FIXME: This lowering of __finally can't actually work, it will have to
// change.
static unsigned g = 0;
-void basic_finally() {
+void basic_finally(void) {
++g;
__try {
j();
@@ -150,3 +150,27 @@ void basic_finally() {
// CHECK: add i32 %{{.*}}, -1
// CHECK: store i32 %{{.*}}, i32* @g
// CHECK: resume
+
+int returns_int(void);
+int except_return(void) {
+ __try {
+ return returns_int();
+ } __except(1) {
+ return 42;
+ }
+}
+// CHECK-LABEL: define i32 @except_return()
+// CHECK: %[[tmp:[^ ]*]] = invoke i32 @returns_int()
+// CHECK: to label %[[cont:[^ ]*]] unwind label %[[lpad:[^ ]*]]
+//
+// CHECK: [[cont]]
+// CHECK: store i32 %[[tmp]], i32* %[[rv:[^ ]*]]
+// CHECK: br label %[[retbb:[^ ]*]]
+//
+// CHECK: [[lpad]]
+// CHECK: store i32 42, i32* %[[rv]]
+// CHECK: br label %[[retbb]]
+//
+// CHECK: [[retbb]]
+// CHECK: %[[r:[^ ]*]] = load i32* %[[rv]]
+// CHECK: ret i32 %[[r]]
OpenPOWER on IntegriCloud