Skip to content

SIL: define mark_dependence_addr to read and write to its address operand #81684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025

Conversation

eeckstein
Copy link
Contributor

This prevents simplification and SILCombine passes to remove (alive) mark_dependence_addr. The instruction is conceptually equivalent to

  %v = load %addr
  %d = mark_dependence %v on %base
  store %d to %addr

Therefore the address operand has to be defined as writing to the address.

…perand

This prevents simplification and SILCombine passes to remove (alive) `mark_dependence_addr`.
The instruction is conceptually equivalent to
```
  %v = load %addr
  %d = mark_dependence %v on %base
  store %d to %addr
```

Therefore the address operand has to be defined as writing to the address.
@eeckstein eeckstein requested review from kavon and jckarter as code owners May 21, 2025 18:32
@eeckstein eeckstein requested review from atrick and removed request for kavon May 21, 2025 18:32
@eeckstein
Copy link
Contributor Author

@swift-ci smoke test

@eeckstein
Copy link
Contributor Author

@swift-ci smoke test macos

@eeckstein eeckstein merged commit 021bd4a into swiftlang:main May 22, 2025
3 checks passed
@@ -253,6 +253,9 @@ bool noncopyable::memInstMustReinitialize(Operand *memOper) {
auto *CAI = cast<ExplicitCopyAddrInst>(memInst);
return CAI->getDest() == address && !CAI->isInitializationOfDest();
}
case SILInstructionKind::MarkDependenceAddrInst: {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC memInstMustReinitialize should only be true for the address operand of mark_dependence_addr. I don't think a simple read of the base qualifies.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first try. But the move-only checker crashes if it only returns true for address.

@eeckstein eeckstein deleted the fix-mark-dependence-addr branch May 22, 2025 06:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants