[llvm-branch-commits] [cfe-branch] r367209 - Merging r367055:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jul 29 01:56:01 PDT 2019
Author: hans
Date: Mon Jul 29 01:56:00 2019
New Revision: 367209
URL: http://llvm.org/viewvc/llvm-project?rev=367209&view=rev
Log:
Merging r367055:
------------------------------------------------------------------------
r367055 | compnerd | 2019-07-25 22:59:48 +0200 (Thu, 25 Jul 2019) | 6 lines
Revert "Revert "CodeGen: ensure placeholder instruction for cleanup is created""
This reverts commit fd1274fa78cb0fd32cc1fa2e6f5bb8e62d29df19.
Add an explicit triple for the test which is pattern matching overly
aggressively.
------------------------------------------------------------------------
Added:
cfe/branches/release_90/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp
- copied unchanged from r367055, cfe/trunk/test/CodeGenCXX/pr40771-ctad-with-lambda-copy-capture.cpp
Modified:
cfe/branches/release_90/ (props changed)
cfe/branches/release_90/lib/CodeGen/CGExprAgg.cpp
Propchange: cfe/branches/release_90/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 29 01:56:00 2019
@@ -1,4 +1,4 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:366429,366448,366457,366474,366480,366483,366511,366670,366694,366699,367039,367103,367134
+/cfe/trunk:366429,366448,366457,366474,366480,366483,366511,366670,366694,366699,367039,367055,367103,367134
/cfe/trunk/test:170344
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/release_90/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_90/lib/CodeGen/CGExprAgg.cpp?rev=367209&r1=367208&r2=367209&view=diff
==============================================================================
--- cfe/branches/release_90/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/branches/release_90/lib/CodeGen/CGExprAgg.cpp Mon Jul 29 01:56:00 2019
@@ -1495,6 +1495,13 @@ void AggExprEmitter::VisitInitListExpr(I
// initializers throws an exception.
SmallVector<EHScopeStack::stable_iterator, 16> cleanups;
llvm::Instruction *cleanupDominator = nullptr;
+ auto addCleanup = [&](const EHScopeStack::stable_iterator &cleanup) {
+ cleanups.push_back(cleanup);
+ if (!cleanupDominator) // create placeholder once needed
+ cleanupDominator = CGF.Builder.CreateAlignedLoad(
+ CGF.Int8Ty, llvm::Constant::getNullValue(CGF.Int8PtrTy),
+ CharUnits::One());
+ };
unsigned curInitIndex = 0;
@@ -1519,7 +1526,7 @@ void AggExprEmitter::VisitInitListExpr(I
if (QualType::DestructionKind dtorKind =
Base.getType().isDestructedType()) {
CGF.pushDestroy(dtorKind, V, Base.getType());
- cleanups.push_back(CGF.EHStack.stable_begin());
+ addCleanup(CGF.EHStack.stable_begin());
}
}
}
@@ -1596,15 +1603,9 @@ void AggExprEmitter::VisitInitListExpr(I
= field->getType().isDestructedType()) {
assert(LV.isSimple());
if (CGF.needsEHCleanup(dtorKind)) {
- if (!cleanupDominator)
- cleanupDominator = CGF.Builder.CreateAlignedLoad(
- CGF.Int8Ty,
- llvm::Constant::getNullValue(CGF.Int8PtrTy),
- CharUnits::One()); // placeholder
-
CGF.pushDestroy(EHCleanup, LV.getAddress(), field->getType(),
CGF.getDestroyer(dtorKind), false);
- cleanups.push_back(CGF.EHStack.stable_begin());
+ addCleanup(CGF.EHStack.stable_begin());
pushedCleanup = true;
}
}
@@ -1620,6 +1621,8 @@ void AggExprEmitter::VisitInitListExpr(I
// Deactivate all the partial cleanups in reverse order, which
// generally means popping them.
+ assert((cleanupDominator || cleanups.empty()) &&
+ "Missing cleanupDominator before deactivating cleanup blocks");
for (unsigned i = cleanups.size(); i != 0; --i)
CGF.DeactivateCleanupBlock(cleanups[i-1], cleanupDominator);
More information about the llvm-branch-commits
mailing list