Revert "Produce less broken basic block sequences for __finally blocks."
authorDaniel Jasper <djasper@google.com>
Wed, 25 Feb 2015 10:07:14 +0000 (10:07 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 25 Feb 2015 10:07:14 +0000 (10:07 +0000)
The test is broken on buildbots:
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/2279/

This reverts commit adda738b6dc533c42db5f5f5b31344098a3aba7d.

llvm-svn: 230472

clang/lib/CodeGen/CGException.cpp
clang/test/CodeGen/exceptions-seh-finally.c

index b7953bc..61f538b 100644 (file)
@@ -813,8 +813,8 @@ llvm::BasicBlock *CodeGenFunction::EmitLandingPad() {
   bool hasFilter = false;
   SmallVector<llvm::Value*, 4> filterTypes;
   llvm::SmallPtrSet<llvm::Value*, 4> catchTypes;
-  for (EHScopeStack::iterator I = EHStack.begin(), E = EHStack.end(); I != E;
-       ++I) {
+  for (EHScopeStack::iterator I = EHStack.begin(), E = EHStack.end();
+         I != E; ++I) {
 
     switch (I->getKind()) {
     case EHScope::Cleanup:
@@ -1927,7 +1927,6 @@ void CodeGenFunction::ExitSEHTryStmt(const SEHTryStmt &S, SEHFinallyInfo &FI) {
     assert(FI.ContBB && "did not emit normal cleanup");
 
     // Emit the code into FinallyBB.
-    CGBuilderTy::InsertPoint SavedIP = Builder.saveIP();
     Builder.SetInsertPoint(FI.FinallyBB);
     EmitStmt(Finally->getBlock());
 
@@ -1950,7 +1949,7 @@ void CodeGenFunction::ExitSEHTryStmt(const SEHTryStmt &S, SEHFinallyInfo &FI) {
       Builder.CreateBr(FI.ContBB);
     }
 
-    Builder.restoreIP(SavedIP);
+    Builder.SetInsertPoint(FI.ContBB);
 
     return;
   }
index ccabc40..4cd82d0 100644 (file)
@@ -160,45 +160,3 @@ void noreturn_finally() {
 // CHECK-NEXT: cleanup
 // CHECK: store i8 1, i8* %
 // CHECK: br label %[[finally]]
-
-int finally_with_return() {
-  __try {
-    return 42;
-  } __finally {
-  }
-}
-// CHECK-LABEL: define i32 @finally_with_return()
-// CHECK: store i8 0, i8* %
-// CHECK-NEXT: br label %[[finally:[^ ]*]]
-//
-// CHECK: [[finally]]
-// CHECK-NEXT: br label %[[finallycont:[^ ]*]]
-//
-// CHECK: [[finallycont]]
-// CHECK-NEXT: ret i32 42
-
-int nested___finally___finally() {
-  __try {
-    __try {
-    } __finally {
-      return 1;
-    }
-  } __finally {
-    // Intentionally no return here.
-  }
-  return 0;
-}
-// CHECK-LABEL: define i32 @nested___finally___finally
-// CHECK: store i8 0, i8* %
-// CHECK-NEXT: br label %[[finally:[^ ]*]]
-//
-// CHECK: [[finally]]
-// CHECK-NEXT:  store i32 1, i32* %cleanup.dest.slot
-// CHECK-NEXT:  store i8 0, i8* %abnormal.termination.slot
-// CHECK-NEXT: br label %[[outerfinally:[^ ]*]]
-//
-// CHECK: [[outerfinally]]
-// CHECK-NEXT: br label %[[finallycont:[^ ]*]]
-//
-// CHECK: [[finallycont]]
-// CHECK-NEXT: ret i32 1