diff options
| author | John McCall <rjmccall@apple.com> | 2011-08-11 02:22:43 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2011-08-11 02:22:43 +0000 |
| commit | 8e4c74bb7c515099d97a330c24a48126c3222a6d (patch) | |
| tree | d2d7299774aa1f5bc2c59170050676c9e23232db /clang/test | |
| parent | 3ae39f8ad150f689b359b172ef4bdc41f47e9981 (diff) | |
| download | bcm5719-llvm-8e4c74bb7c515099d97a330c24a48126c3222a6d.tar.gz bcm5719-llvm-8e4c74bb7c515099d97a330c24a48126c3222a6d.zip | |
Simplify EH control flow by observing that EH scopes form a simple
hierarchy of delegation, and that EH selector values are meaningful
function-wide (good thing, too, or inlining wouldn't work).
2,3d
1a
hierarchy of delegation and that EH selector values have the same
meaning everywhere in the function instead of being meaningful only
in the context of a specific selector.
This removes the need for routing edges through EH cleanups,
since a cleanup simply always branches to its enclosing scope.
llvm-svn: 137293
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGenCXX/destructors.cpp | 1 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/eh.cpp | 30 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/exceptions.cpp | 2 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/goto.cpp | 1 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/partial-destruction.cpp | 3 |
5 files changed, 15 insertions, 22 deletions
diff --git a/clang/test/CodeGenCXX/destructors.cpp b/clang/test/CodeGenCXX/destructors.cpp index bfdf93c5a29..dc24551a593 100644 --- a/clang/test/CodeGenCXX/destructors.cpp +++ b/clang/test/CodeGenCXX/destructors.cpp @@ -237,7 +237,6 @@ namespace test5 { // CHECK: [[ELEMS:%.*]] = alloca [5 x [[A:%.*]]], align // CHECK-NEXT: [[EXN:%.*]] = alloca i8* // CHECK-NEXT: [[SEL:%.*]] = alloca i32 - // CHECK-NEXT: [[EHCLEANUP:%.*]] = alloca i32 // CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [5 x [[A]]]* [[ELEMS]], i32 0, i32 0 // CHECK-NEXT: [[END:%.*]] = getelementptr inbounds [[A]]* [[BEGIN]], i64 5 // CHECK-NEXT: br label diff --git a/clang/test/CodeGenCXX/eh.cpp b/clang/test/CodeGenCXX/eh.cpp index 736b124ab48..24807d92d70 100644 --- a/clang/test/CodeGenCXX/eh.cpp +++ b/clang/test/CodeGenCXX/eh.cpp @@ -32,7 +32,6 @@ void test2() { // CHECK: define void @_Z5test2v() // CHECK: [[EXNVAR:%.*]] = alloca i8* // CHECK-NEXT: [[SELECTORVAR:%.*]] = alloca i32 -// CHECK-NEXT: [[CLEANUPDESTVAR:%.*]] = alloca i32 // CHECK-NEXT: [[EXNOBJ:%.*]] = call i8* @__cxa_allocate_exception(i64 16) // CHECK-NEXT: [[EXN:%.*]] = bitcast i8* [[EXNOBJ]] to [[DSTAR:%[^*]*\*]] // CHECK-NEXT: invoke void @_ZN7test2_DC1ERKS_([[DSTAR]] [[EXN]], [[DSTAR]] @d2) @@ -107,7 +106,6 @@ namespace test7 { // CHECK: [[CAUGHTEXNVAR:%.*]] = alloca i8* // CHECK-NEXT: [[SELECTORVAR:%.*]] = alloca i32 // CHECK-NEXT: [[INTCATCHVAR:%.*]] = alloca i32 -// CHECK-NEXT: [[EHCLEANUPDESTVAR:%.*]] = alloca i32 try { try { // CHECK-NEXT: [[EXNALLOC:%.*]] = call i8* @__cxa_allocate_exception @@ -118,24 +116,28 @@ namespace test7 { } // CHECK: [[CAUGHTEXN:%.*]] = call i8* @llvm.eh.exception() -// CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] // CHECK-NEXT: [[SELECTOR:%.*]] = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*), i8* null) +// CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] // CHECK-NEXT: store i32 [[SELECTOR]], i32* [[SELECTORVAR]] -// CHECK-NEXT: call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) -// CHECK-NEXT: icmp eq +// CHECK-NEXT: br label +// CHECK: [[SELECTOR:%.*]] = load i32* [[SELECTORVAR]] +// CHECK-NEXT: [[T0:%.*]] = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*)) +// CHECK-NEXT: icmp eq i32 [[SELECTOR]], [[T0]] // CHECK-NEXT: br i1 -// CHECK: load i8** [[CAUGHTEXNVAR]] -// CHECK-NEXT: call i8* @__cxa_begin_catch -// CHECK: invoke void @__cxa_rethrow +// CHECK: [[T0:%.*]] = load i8** [[CAUGHTEXNVAR]] +// CHECK-NEXT: [[T1:%.*]] = call i8* @__cxa_begin_catch(i8* [[T0]]) +// CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to i32* +// CHECK-NEXT: [[T3:%.*]] = load i32* [[T2]] +// CHECK-NEXT: store i32 [[T3]], i32* {{%.*}}, align 4 +// CHECK-NEXT: invoke void @__cxa_rethrow catch (int) { throw; } } // CHECK: [[CAUGHTEXN:%.*]] = call i8* @llvm.eh.exception() -// CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] // CHECK-NEXT: [[SELECTOR:%.*]] = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* [[CAUGHTEXN]], i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) +// CHECK-NEXT: store i8* [[CAUGHTEXN]], i8** [[CAUGHTEXNVAR]] // CHECK-NEXT: store i32 [[SELECTOR]], i32* [[SELECTORVAR]] -// CHECK-NEXT: store i32 1, i32* [[EHCLEANUPDESTVAR]] // CHECK-NEXT: call void @__cxa_end_catch() // CHECK-NEXT: br label // CHECK: load i8** [[CAUGHTEXNVAR]] @@ -186,15 +188,14 @@ namespace test9 { // CHECK: invoke void @_ZN5test96opaqueEv() opaque(); } catch (int x) { + // CHECK: call i8* @llvm.eh.exception + // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* {{.*}}, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*)) + // CHECK: call i8* @__cxa_begin_catch // CHECK: invoke void @_ZN5test96opaqueEv() // CHECK: invoke void @__cxa_rethrow() opaque(); } - - // landing pad from first call to invoke - // CHECK: call i8* @llvm.eh.exception - // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* {{.*}}, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* bitcast (i8** @_ZTIi to i8*)) } // __cxa_end_catch can throw for some kinds of caught exceptions. @@ -406,7 +407,6 @@ namespace test16 { // CHECK-NEXT: [[TEMP:%.*]] = alloca [[A:%.*]], // CHECK-NEXT: [[EXNSLOT:%.*]] = alloca i8* // CHECK-NEXT: [[SELECTORSLOT:%.*]] = alloca i32 - // CHECK-NEXT: [[EHDEST:%.*]] = alloca i32 // CHECK-NEXT: [[TEMP_ACTIVE:%.*]] = alloca i1 cond() ? throw B(A()) : foo(); diff --git a/clang/test/CodeGenCXX/exceptions.cpp b/clang/test/CodeGenCXX/exceptions.cpp index b32b90bf741..0ce9679a34b 100644 --- a/clang/test/CodeGenCXX/exceptions.cpp +++ b/clang/test/CodeGenCXX/exceptions.cpp @@ -276,7 +276,6 @@ namespace test5 { // CHECK-NEXT: [[SELECTORSLOT:%.*]] = alloca i32 // CHECK-NEXT: [[A:%.*]] = alloca [[A_T:%.*]], align 1 // CHECK-NEXT: [[T:%.*]] = alloca [[T_T:%.*]], align 1 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: invoke void @_ZN5test53fooEv() // CHECK: [[EXN:%.*]] = load i8** [[EXNSLOT]] // CHECK-NEXT: [[ADJ:%.*]] = call i8* @__cxa_get_exception_ptr(i8* [[EXN]]) @@ -325,7 +324,6 @@ namespace test7 { // CHECK-NEXT: alloca [[A:%.*]], // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[OUTER_A:%.*]] = alloca i1 // CHECK-NEXT: alloca i8* // CHECK-NEXT: [[INNER_NEW:%.*]] = alloca i1 diff --git a/clang/test/CodeGenCXX/goto.cpp b/clang/test/CodeGenCXX/goto.cpp index 9a12a912539..f32847d122b 100644 --- a/clang/test/CodeGenCXX/goto.cpp +++ b/clang/test/CodeGenCXX/goto.cpp @@ -13,7 +13,6 @@ namespace test0 { // CHECK-NEXT: [[Z:%.*]] = alloca [[A]] // CHECK-NEXT: [[EXN:%.*]] = alloca i8* // CHECK-NEXT: [[SEL:%.*]] = alloca i32 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[V:%.*]] = alloca [[V:%.*]]*, // CHECK-NEXT: [[TMP:%.*]] = alloca [[A]] // CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1 diff --git a/clang/test/CodeGenCXX/partial-destruction.cpp b/clang/test/CodeGenCXX/partial-destruction.cpp index 82deca06cf8..b28c1384b8d 100644 --- a/clang/test/CodeGenCXX/partial-destruction.cpp +++ b/clang/test/CodeGenCXX/partial-destruction.cpp @@ -16,7 +16,6 @@ namespace test0 { // CHECK-NEXT: [[ENDVAR:%.*]] = alloca [[A]]* // CHECK-NEXT: [[EXN:%.*]] = alloca i8* // CHECK-NEXT: [[SEL:%.*]] = alloca i32 - // CHECK-NEXT: [[CLEANUP:%.*]] = alloca i32 // Initialize. // CHECK-NEXT: [[E_BEGIN:%.*]] = getelementptr inbounds [10 x [[A]]]* [[AS]], i64 0, i64 0 @@ -100,7 +99,6 @@ namespace test1 { // CHECK: [[V:%.*]] = alloca [[B:%.*]], align 4 // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 - // CHECK-NEXT: alloca i32 // CHECK-NEXT: [[X:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 0 // CHECK-NEXT: call void @_ZN5test11AC1Ei([[A:%.*]]* [[X]], i32 5) // CHECK-NEXT: [[Y:%.*]] = getelementptr inbounds [[B]]* [[V]], i32 0, i32 1 @@ -129,7 +127,6 @@ namespace test2 { // CHECK: [[V:%.*]] = alloca [4 x [7 x [[A:%.*]]]], align 1 // CHECK-NEXT: alloca i8* // CHECK-NEXT: alloca i32 - // CHECK-NEXT: alloca i32 // Main initialization loop. // CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [4 x [7 x [[A]]]]* [[V]], i32 0, i32 0, i32 0 |

