@@ -79,7 +79,7 @@ struct FindElidedCopies : VarScopeVisitor {
7979 static void addDeclaration (VarFrame* frame,
8080 Qualifier intentOrKind,
8181 const NamedDecl* ast);
82- static void addCopyInit (VarFrame* frame, ID fromVarId, ID point);
82+ void addCopyInit (VarFrame* frame, ID fromVarId, ID point);
8383 static void addMention (VarFrame* frame, ID varId);
8484
8585 // save the copy-elided variables in frame to allElidedCopyFromIds
@@ -236,7 +236,9 @@ void FindElidedCopies::addCopyInit(VarFrame* frame, ID fromVarId, ID point) {
236236 // get the map entry, default-initializing it if there was none
237237 CopyElisionState& state = frame->copyElisionState [fromVarId];
238238 state.lastIsCopy = true ;
239- state.points .clear ();
239+ if (!outermostContainingTuple ()) {
240+ state.points .clear ();
241+ }
240242 state.points .insert (point);
241243}
242244void FindElidedCopies::addMention (VarFrame* frame, ID varId) {
@@ -379,36 +381,36 @@ void FindElidedCopies::handleDeclaration(const VarLikeDecl* ast,
379381 if (initExpr) {
380382 VarFrame* frame = currentFrame ();
381383 ID lhsVarId = ast->id ();
382- QualifiedType lhsType = rv.byId (lhsVarId).type ();
383- if (auto tupleExprInit = initExpr->toTuple ()) {
384- // handle init with tuple expression
385- for (int i = 0 ; i < tupleExprInit->numActuals (); i++) {
386- auto actual = tupleExprInit->actual (i);
387- if (actual->isTuple ()) {
388- // processSingleDeclHelper(ast, actual, QualifiedType(),
389- // isFormal, intentOrKind, rv);
390- handleDeclaration (ast, parent, actual, QualifiedType (), intentOrKind,
391- isFormal, rv);
392- } else {
393- ID rhsVarId = refersToId (actual, rv);
394- if (!rhsVarId.isEmpty () && isEligibleVarInAnyFrame (rhsVarId)) {
395- // check that the types are the same
396- if (rv.hasId (lhsVarId) && rv.hasId (rhsVarId)) {
397- if (lhsType.type () && lhsType.type ()->isTupleType ()) {
398- const TupleType* ttype = lhsType.type ()->toTupleType ();
399- CHPL_ASSERT (ttype->numElements () == tupleExprInit->numActuals ());
400- QualifiedType lhsEltType = ttype->elementType (i);
401-
402- QualifiedType rhsType = rv.byId (rhsVarId).type ();
403- if (copyElisionAllowedForTypes (lhsEltType, rhsType, ast, rv)) {
404- addCopyInit (frame, rhsVarId, actual->id ());
405- }
406- }
407- }
408- }
409- }
410- }
411- }
384+ // QualifiedType lhsType = rv.byId(lhsVarId).type();
385+ // if (auto tupleExprInit = initExpr->toTuple()) {
386+ // // handle init with tuple expression
387+ // for (int i = 0; i < tupleExprInit->numActuals(); i++) {
388+ // auto actual = tupleExprInit->actual(i);
389+ // if (actual->isTuple()) {
390+ // // processSingleDeclHelper(ast, actual, QualifiedType(),
391+ // // isFormal, intentOrKind, rv);
392+ // handleDeclaration(ast, parent, actual, QualifiedType(), intentOrKind,
393+ // isFormal, rv);
394+ // } else {
395+ // ID rhsVarId = refersToId(actual, rv);
396+ // if (!rhsVarId.isEmpty() && isEligibleVarInAnyFrame(rhsVarId)) {
397+ // // check that the types are the same
398+ // if (rv.hasId(lhsVarId) && rv.hasId(rhsVarId)) {
399+ // if (lhsType.type() && lhsType.type()->isTupleType()) {
400+ // const TupleType* ttype = lhsType.type()->toTupleType();
401+ // CHPL_ASSERT(ttype->numElements() == tupleExprInit->numActuals());
402+ // QualifiedType lhsEltType = ttype->elementType(i);
403+
404+ // QualifiedType rhsType = rv.byId(rhsVarId).type();
405+ // if (copyElisionAllowedForTypes(lhsEltType, rhsType, ast, rv)) {
406+ // addCopyInit(frame, rhsVarId, actual->id());
407+ // }
408+ // }
409+ // }
410+ // }
411+ // }
412+ // }
413+ // }
412414 ID rhsVarId = refersToId (initExpr, rv);
413415 if (!rhsVarId.isEmpty () && isEligibleVarInAnyFrame (rhsVarId)) {
414416 // check that the types are the same
0 commit comments