Hi Sebastian, I went ahead and reverted this in r151203. Chad
On Feb 22, 2012, at 12:46 PM, Chad Rosier wrote: > Hi Sebastian, > The test you added here is failing on one of our internal buildbots. > > Here's the exact errors: > ******************** TEST 'Clang :: CodeGenCXX/new-array-init-exceptions.cpp' > FAILED ********************Script: > -- > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang-build/Release/bin/clang > -cc1 -internal-isystem > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang-build/Release/bin/../lib/clang/3.1/include > -std=c++11 -triple i386-unknown-unknown -fexceptions -fcxx-exceptions > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang.src/test/CodeGenCXX/new-array-init-exceptions.cpp > -emit-llvm -o - | FileCheck > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang.src/test/CodeGenCXX/new-array-init-exceptions.cpp > -- > Exit Code: 1 > Command Output (stderr): > -- > /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-R/clang.src/test/CodeGenCXX/new-array-init-exceptions.cpp:20:12: > error: expected string not found in input > // CHECK: [[LPAD]]: > ^ > <stdin>:56:1: note: scanning from here > ; <label>:27 ; preds = %25 > ^ > <stdin>:56:1: note: with variable "LPAD" equal to "31" > ; <label>:27 ; preds = %25 > ^ > <stdin>:56:10: note: possible intended match here > ; <label>:27 ; preds = %25 > ^ > -- > > ******************** > Chad > > > On Feb 22, 2012, at 9:37 AM, Sebastian Redl wrote: > >> Author: cornedbee >> Date: Wed Feb 22 11:37:59 2012 >> New Revision: 151172 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=151172&view=rev >> Log: >> Unwind path cleanup for array new list initializers. >> >> Added: >> cfe/trunk/test/CodeGenCXX/new-array-init-exceptions.cpp >> Modified: >> cfe/trunk/lib/CodeGen/CGExprCXX.cpp >> >> Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=151172&r1=151171&r2=151172&view=diff >> ============================================================================== >> --- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original) >> +++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Wed Feb 22 11:37:59 2012 >> @@ -804,12 +804,32 @@ >> unsigned initializerElements = 0; >> >> const Expr *Init = E->getInitializer(); >> + llvm::AllocaInst *endOfInit = 0; >> + QualType::DestructionKind dtorKind = elementType.isDestructedType(); >> + EHScopeStack::stable_iterator cleanup; >> + llvm::Instruction *cleanupDominator = 0; >> // If the initializer is an initializer list, first do the explicit >> elements. >> if (const InitListExpr *ILE = dyn_cast<InitListExpr>(Init)) { >> initializerElements = ILE->getNumInits(); >> - QualType elementType = E->getAllocatedType(); >> - // FIXME: exception-safety for the explicit initializers >> + >> + // Enter a partial-destruction cleanup if necessary. >> + if (needsEHCleanup(dtorKind)) { >> + // In principle we could tell the cleanup where we are more >> + // directly, but the control flow can get so varied here that it >> + // would actually be quite complex. Therefore we go through an >> + // alloca. >> + endOfInit = CreateTempAlloca(beginPtr->getType(), "array.endOfInit"); >> + cleanupDominator = Builder.CreateStore(beginPtr, endOfInit); >> + pushIrregularPartialArrayCleanup(beginPtr, endOfInit, elementType, >> + getDestroyer(dtorKind)); >> + cleanup = EHStack.stable_begin(); >> + } >> + >> for (unsigned i = 0, e = ILE->getNumInits(); i != e; ++i) { >> + // Tell the cleanup that it needs to destroy up to this >> + // element. TODO: some of these stores can be trivially >> + // observed to be unnecessary. >> + if (endOfInit) Builder.CreateStore(explicitPtr, endOfInit); >> StoreAnyExprIntoOneUnit(*this, ILE->getInit(i), elementType, >> explicitPtr); >> explicitPtr =Builder.CreateConstGEP1_32(explicitPtr, 1, >> "array.exp.next"); >> } >> @@ -825,7 +845,12 @@ >> // anything left to initialize. >> if (llvm::ConstantInt *constNum = >> dyn_cast<llvm::ConstantInt>(numElements)) { >> // If all elements have already been initialized, skip the whole loop. >> - if (constNum->getZExtValue() <= initializerElements) return; >> + if (constNum->getZExtValue() <= initializerElements) { >> + // If there was a cleanup, deactivate it. >> + if (cleanupDominator) >> + DeactivateCleanupBlock(cleanup, cleanupDominator);; >> + return; >> + } >> } else { >> llvm::BasicBlock *nonEmptyBB = createBasicBlock("new.loop.nonempty"); >> llvm::Value *isEmpty = Builder.CreateICmpEQ(explicitPtr, endPtr, >> @@ -845,11 +870,11 @@ >> Builder.CreatePHI(explicitPtr->getType(), 2, "array.cur"); >> curPtr->addIncoming(explicitPtr, entryBB); >> >> + // Store the new cleanup position for irregular cleanups. >> + if (endOfInit) Builder.CreateStore(curPtr, endOfInit); >> + >> // Enter a partial-destruction cleanup if necessary. >> - QualType::DestructionKind dtorKind = elementType.isDestructedType(); >> - EHScopeStack::stable_iterator cleanup; >> - llvm::Instruction *cleanupDominator = 0; >> - if (needsEHCleanup(dtorKind)) { >> + if (!cleanupDominator && needsEHCleanup(dtorKind)) { >> pushRegularPartialArrayCleanup(beginPtr, curPtr, elementType, >> getDestroyer(dtorKind)); >> cleanup = EHStack.stable_begin(); >> >> Added: cfe/trunk/test/CodeGenCXX/new-array-init-exceptions.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/new-array-init-exceptions.cpp?rev=151172&view=auto >> ============================================================================== >> --- cfe/trunk/test/CodeGenCXX/new-array-init-exceptions.cpp (added) >> +++ cfe/trunk/test/CodeGenCXX/new-array-init-exceptions.cpp Wed Feb 22 >> 11:37:59 2012 >> @@ -0,0 +1,40 @@ >> +// RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown -fexceptions >> -fcxx-exceptions %s -emit-llvm -o - | FileCheck %s >> + >> +struct Throws { >> + Throws(int); >> + Throws(); >> + ~Throws(); >> +}; >> + >> +// CHECK: define void @_Z7cleanupi >> +void cleanup(int n) { >> + // CHECK: invoke void @_ZN6ThrowsC1Ei >> + // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD:[^ ]+]] >> + // CHECK: invoke void @_ZN6ThrowsC1Ei >> + // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]] >> + // CHECK: invoke void @_ZN6ThrowsC1Ei >> + // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]] >> + // CHECK: invoke void @_ZN6ThrowsC1Ev >> + // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]] >> + new Throws[n] { 1, 2, 3 }; >> + // CHECK: [[LPAD]]: >> + // CHECK-NEXT: landingpad >> + // CHECK: call void @_ZN6ThrowsD1Ev >> + // CHECK: call void @_ZdaPv >> +} >> + >> + >> +// CHECK: define void @_Z7cleanupv >> +void cleanup() { >> + // CHECK: invoke void @_ZN6ThrowsC1Ei >> + // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2:[^ ]+]] >> + // CHECK: invoke void @_ZN6ThrowsC1Ei >> + // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2]] >> + // CHECK: invoke void @_ZN6ThrowsC1Ei >> + // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2]] >> + new Throws[3] { 1, 2, 3 }; >> + // CHECK: [[LPAD2]]: >> + // CHECK-NEXT: landingpad >> + // CHECK: call void @_ZN6ThrowsD1Ev >> + // CHECK: call void @_ZdaPv >> +} >> >> >> _______________________________________________ >> cfe-commits mailing list >> [email protected] >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
