@@ -156,59 +156,38 @@ struct UseDefChainVisitor
156156 isMerge = true ;
157157 break ;
158158 case ProjectionKind::Enum: {
159- // Enum is never a merge since it always has a single tuple field... but
160- // it can be actor isolated.
161- if (!bool (actorIsolation)) {
162- auto *uedi = cast<UncheckedTakeEnumDataAddrInst>(inst);
163- auto i = getActorIsolation (uedi->getEnumDecl ());
164- // If our operand decl is actor isolated, then we want to stop looking
165- // through since it is Sendable.
166- if (i.isActorIsolated ()) {
167- actorIsolation = i;
168- return SILValue ();
169- }
170- }
159+ auto op = cast<UncheckedTakeEnumDataAddrInst>(inst)->getOperand ();
160+
161+ // See if our operand type is a sendable type. In such a case, we do not
162+ // want to look through our operand.
163+ if (!isNonSendableType (op->getType (), op->getFunction ()))
164+ return SILValue ();
165+
171166 break ;
172167 }
173168 case ProjectionKind::Tuple: {
174169 // These are merges if we have multiple fields.
175- auto *tti = cast<TupleElementAddrInst>(inst);
170+ auto op = cast<TupleElementAddrInst>(inst)-> getOperand ( );
176171
177- // See if our result type is a sendable type. In such a case, we do not
178- // want to look through the tuple_element_addr since we do not want to
179- // identify the sendable type with the non-sendable operand. These we
180- // are always going to ignore anyways since a sendable let/var field of
181- // a struct can always be used.
182- if (!isNonSendableType (tti->getType (), tti->getFunction ()))
172+ if (!isNonSendableType (op->getType (), op->getFunction ()))
183173 return SILValue ();
184174
185- isMerge |= tti-> getOperand () ->getType ().getNumTupleElements () > 1 ;
175+ isMerge |= op ->getType ().getNumTupleElements () > 1 ;
186176 break ;
187177 }
188178 case ProjectionKind::Struct:
189- auto *sea = cast<StructElementAddrInst>(inst);
190-
191- // See if our type is actor isolated.
192- if (!bool (actorIsolation)) {
193- auto i = getActorIsolation (sea->getStructDecl ());
194- // If our parent type is actor isolated then we do not want to keep on
195- // walking up from use->def since the value is considered Sendable.
196- if (i.isActorIsolated ()) {
197- actorIsolation = i;
198- return SILValue ();
199- }
200- }
179+ auto op = cast<StructElementAddrInst>(inst)->getOperand ();
201180
202181 // See if our result type is a sendable type. In such a case, we do not
203182 // want to look through the struct_element_addr since we do not want to
204183 // identify the sendable type with the non-sendable operand. These we
205184 // are always going to ignore anyways since a sendable let/var field of
206185 // a struct can always be used.
207- if (!isNonSendableType (sea ->getType (), sea ->getFunction ()))
186+ if (!isNonSendableType (op ->getType (), op ->getFunction ()))
208187 return SILValue ();
209188
210189 // These are merges if we have multiple fields.
211- isMerge |= sea-> getOperand () ->getType ().getNumNominalFields () > 1 ;
190+ isMerge |= op ->getType ().getNumNominalFields () > 1 ;
212191 break ;
213192 }
214193 }
@@ -1457,6 +1436,8 @@ class PartitionOpTranslator {
14571436 LLVM_DEBUG (llvm::dbgs () << " %%" << state->getID () << " : " ;
14581437 state->print (llvm::dbgs ()); llvm::dbgs () << *arg);
14591438 nonSendableJoinedIndices.push_back (state->getID ());
1439+ } else {
1440+ LLVM_DEBUG (llvm::dbgs () << " Sendable: " << *arg);
14601441 }
14611442 }
14621443
0 commit comments