Skip to content

[ObjCARC] Tolerate missing attachedcall op by ignoring the bundle. #4211

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

Conversation

ahmedbougacha
Copy link

In some situations (swiftc bitcode) we end up running the
objc-arc-contract pass twice, which is not supposed to occur.

This was fine until relatively recently, where the
clang.arc.attachedcall operand bundle support caused the second run to
crash: when emitting the calls, the pass was assuming that the bundle
always had an operand, which is not true in 5.6.

That will be true in the future, but that's a massive change.
For now, try to workaround the issue by ignoring the nullary bundles,
and not emitting the call.

The pass will get a little confused, but the semantics are preserved
by the presence of the intrinsic call later on (emitted by the first
run of the pass). However, one difference is that we're now going
to emit a redundant inline-asm marker, since we're not able to
eliminate the (standalone) intrinsic anymore, as we don't remember
emitting it in the pass. That costs us an extra nop, which is okay.

rdar://90366906

In some situations (swiftc bitcode) we end up running the
objc-arc-contract pass twice, which is not supposed to occur.

This was fine until relatively recently, where the
clang.arc.attachedcall operand bundle support caused the second run to
crash: when emitting the calls, the pass was assuming that the bundle
always had an operand, which is not true in 5.6.

That will be true in the future, but that's a massive change.
For now, try to workaround the issue by ignoring the nullary bundles,
and not emitting the call.

The pass will get a little confused, but the semantics are preserved
by the presence of the intrinsic call later on (emitted by the first
run of the pass).  However, one difference is that we're now going
to emit a redundant inline-asm marker, since we're not able to
eliminate the (standalone) intrinsic anymore, as we don't remember
emitting it in the pass.  That costs us an extra nop, which is okay.

rdar://90366906
@ahmedbougacha
Copy link
Author

Let's try to test in:
swiftlang/swift#42323

@ahmedbougacha
Copy link
Author

@swift-ci please test

@ahmedbougacha ahmedbougacha merged commit bd8381a into swift/release/5.6 Apr 14, 2022
@ahmedbougacha ahmedbougacha deleted the ahmedbougacha/arccontract-twice-bundle branch April 14, 2022 17:58
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.

1 participant