diff options
author | John McCall <rjmccall@apple.com> | 2010-07-13 20:32:21 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-13 20:32:21 +0000 |
commit | 2b7fc3828e2245604a9b518167418d4bf650d5f2 (patch) | |
tree | 4c139957fc2a59adadc0315e4f5dead1e551c2ac /clang/test | |
parent | caca5488dc290c3cbca702a90e3f7a8be7b23c06 (diff) | |
download | bcm5719-llvm-2b7fc3828e2245604a9b518167418d4bf650d5f2.tar.gz bcm5719-llvm-2b7fc3828e2245604a9b518167418d4bf650d5f2.zip |
Teach IR generation how to lazily emit cleanups. This has a lot of advantages,
mostly in avoiding unnecessary work at compile time but also in producing more
sensible block orderings.
Move the destructor cleanups for local variables over to use lazy cleanups.
Eventually all cleanups will do this; for now we have some awkward code
duplication.
Tell IR generation just to never produce landing pads in -fno-exceptions.
This is a much more comprehensive solution to a problem which previously was
half-solved by checks in most cleanup-generation spots.
llvm-svn: 108270
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/condition.cpp | 1 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/nrvo.cpp | 32 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/metadata_symbols.m | 2 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/unwind-fn.m | 4 |
4 files changed, 20 insertions, 19 deletions
diff --git a/clang/test/CodeGenCXX/condition.cpp b/clang/test/CodeGenCXX/condition.cpp index bbc6d2f73b8..652e7c89c15 100644 --- a/clang/test/CodeGenCXX/condition.cpp +++ b/clang/test/CodeGenCXX/condition.cpp @@ -26,6 +26,7 @@ struct Y { X getX(); +// CHECK: define void @_Z11if_destructi( void if_destruct(int z) { // Verify that the condition variable is destroyed at the end of the // "if" statement. diff --git a/clang/test/CodeGenCXX/nrvo.cpp b/clang/test/CodeGenCXX/nrvo.cpp index 6181f0eee13..8d19b1effe9 100644 --- a/clang/test/CodeGenCXX/nrvo.cpp +++ b/clang/test/CodeGenCXX/nrvo.cpp @@ -57,20 +57,15 @@ X test2(bool B) { // CHECK-EH: call void @_ZN1XC1Ev // CHECK-EH-NEXT: invoke void @_ZN1XC1Ev - // -> %invoke.cont1, %lpad + // -> %invoke.cont, %lpad - // %invoke.cont1: + // %invoke.cont: // CHECK-EH: br i1 // -> %if.then, %if.end // %if.then: returning 'x' // CHECK-EH: invoke void @_ZN1XC1ERKS_ - // -> %cleanup, %lpad5 - - // %invoke.cont: rethrow block for %eh.cleanup. - // This really should be elsewhere in the function. - // CHECK-EH: call void @_Unwind_Resume_or_Rethrow - // CHECK-EH-NEXT: unreachable + // -> %cleanup, %lpad1 // %lpad: landing pad for ctor of 'y', dtor of 'y' // CHECK-EH: call i8* @llvm.eh.exception() @@ -78,25 +73,30 @@ X test2(bool B) { // CHECK-EH-NEXT: br label // -> %eh.cleanup - // %invoke.cont2: normal cleanup for 'x' - // CHECK-EH: call void @_ZN1XD1Ev - // CHECK-EH-NEXT: ret void - - // %lpad5: landing pad for return copy ctors, EH cleanup for 'y' + // %lpad1: landing pad for return copy ctors, EH cleanup for 'y' // CHECK-EH: invoke void @_ZN1XD1Ev // -> %eh.cleanup, %terminate.lpad // %if.end: returning 'y' // CHECK-EH: invoke void @_ZN1XC1ERKS_ - // -> %cleanup, %lpad5 + // -> %cleanup, %lpad1 // %cleanup: normal cleanup for 'y' // CHECK-EH: invoke void @_ZN1XD1Ev - // -> %invoke.cont2, %lpad + // -> %invoke.cont11, %lpad + + // %invoke.cont11: normal cleanup for 'x' + // CHECK-EH: call void @_ZN1XD1Ev + // CHECK-EH-NEXT: ret void // %eh.cleanup: EH cleanup for 'x' // CHECK-EH: invoke void @_ZN1XD1Ev - // -> %invoke.cont, %terminate.lpad + // -> %invoke.cont17, %terminate.lpad + + // %invoke.cont17: rethrow block for %eh.cleanup. + // This really should be elsewhere in the function. + // CHECK-EH: call void @_Unwind_Resume_or_Rethrow + // CHECK-EH-NEXT: unreachable // %terminate.lpad: terminate landing pad. // CHECK-EH: call i8* @llvm.eh.exception() diff --git a/clang/test/CodeGenObjC/metadata_symbols.m b/clang/test/CodeGenObjC/metadata_symbols.m index 59441e523fd..31639466e8b 100644 --- a/clang/test/CodeGenObjC/metadata_symbols.m +++ b/clang/test/CodeGenObjC/metadata_symbols.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -fexceptions -o %t %s // RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s // RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3 diff --git a/clang/test/CodeGenObjC/unwind-fn.m b/clang/test/CodeGenObjC/unwind-fn.m index 0aa8cde024d..48217f07f97 100644 --- a/clang/test/CodeGenObjC/unwind-fn.m +++ b/clang/test/CodeGenObjC/unwind-fn.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck --check-prefix=DEFAULT_EH %s -// RUN: %clang_cc1 -fsjlj-exceptions -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck --check-prefix=SJLJ_EH %s +// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -fexceptions -o - %s | FileCheck --check-prefix=DEFAULT_EH %s +// RUN: %clang_cc1 -fsjlj-exceptions -fobjc-nonfragile-abi -fexceptions -emit-llvm -o - %s | FileCheck --check-prefix=SJLJ_EH %s // DEFAULT_EH: declare void @_Unwind_Resume_or_Rethrow(i8*) // SJLJ_EH: declare void @_Unwind_SjLj_Resume(i8*) |