Why was PR #67155 (Use clang.arc.attachedcall) reverted?

I have commented on the revert PR: Revert "Use clang.arc.attachedcall for emission of objc_retainAutoreleasedReturnValue" by nate-chandler · Pull Request #68095 · swiftlang/swift · GitHub

The reason why this was reverted is because the IR that gets generated relies on an LLVM pass to be run so that an intrinsic is properly lowered (otherwise you get a compiler crash because later stages of the LLVM pipeline don't know about the intrinsic).

The pass that does that is ObjcARCContract. Apparently, if a function is marked with the optnone llvm attribute this pass does not get run. So to reenable the reverted PR one would have to fix this issue.

The fix is likely to mark the ObjCARCContract pass "required".

https://llvm.org/docs/WritingAnLLVMNewPMPass.html#required-passes

1 Like