@@ -437,6 +437,8 @@ bool swift::isLetAddress(SILValue address) {
437437// ===----------------------------------------------------------------------===//
438438
439439bool swift::mayAccessPointer (SILInstruction *instruction) {
440+ assert (!FullApplySite::isa (instruction) && !isa<EndApplyInst>(instruction) &&
441+ !isa<AbortApplyInst>(instruction));
440442 if (!instruction->mayReadOrWriteMemory ())
441443 return false ;
442444 if (isa<BuiltinInst>(instruction)) {
@@ -455,6 +457,11 @@ bool swift::mayAccessPointer(SILInstruction *instruction) {
455457}
456458
457459bool swift::mayLoadWeakOrUnowned (SILInstruction *instruction) {
460+ assert (!FullApplySite::isa (instruction) && !isa<EndApplyInst>(instruction) &&
461+ !isa<AbortApplyInst>(instruction));
462+ if (isa<BuiltinInst>(instruction)) {
463+ return instruction->mayReadOrWriteMemory ();
464+ }
458465 return isa<LoadWeakInst>(instruction)
459466 || isa<LoadUnownedInst>(instruction)
460467 || isa<StrongCopyUnownedValueInst>(instruction)
@@ -463,17 +470,23 @@ bool swift::mayLoadWeakOrUnowned(SILInstruction *instruction) {
463470
464471// / Conservatively, whether this instruction could involve a synchronization
465472// / point like a memory barrier, lock or syscall.
466- bool swift::maySynchronizeNotConsideringSideEffects (SILInstruction *instruction) {
467- return FullApplySite::isa (instruction)
468- || isa<EndApplyInst>(instruction)
469- || isa<AbortApplyInst>(instruction)
470- || isa<HopToExecutorInst>(instruction);
473+ bool swift::maySynchronize (SILInstruction *instruction) {
474+ assert (!FullApplySite::isa (instruction) && !isa<EndApplyInst>(instruction) &&
475+ !isa<AbortApplyInst>(instruction));
476+ if (isa<BuiltinInst>(instruction)) {
477+ return instruction->mayReadOrWriteMemory ();
478+ }
479+ return isa<HopToExecutorInst>(instruction);
471480}
472481
473482bool swift::mayBeDeinitBarrierNotConsideringSideEffects (SILInstruction *instruction) {
483+ if (FullApplySite::isa (instruction) || isa<EndApplyInst>(instruction) ||
484+ isa<AbortApplyInst>(instruction)) {
485+ return true ;
486+ }
474487 bool retval = mayAccessPointer (instruction)
475488 || mayLoadWeakOrUnowned (instruction)
476- || maySynchronizeNotConsideringSideEffects (instruction);
489+ || maySynchronize (instruction);
477490 assert (!retval || !isa<BranchInst>(instruction) && " br as deinit barrier!?" );
478491 return retval;
479492}
0 commit comments