This bug was causing the call to replaceAllUsesWith to crash because the old call instruction and the new call instruction were the same.
rdar://74957948
Differential D97824
[ObjC][ARC] Don't add operand bundle `clang.arc.attachedcall` to a call if the call already has the operand bundle ahatanak on Mar 2 2021, 5:50 PM. Authored by
Details This bug was causing the call to replaceAllUsesWith to crash because the old call instruction and the new call instruction were the same. rdar://74957948
Diff Detail
Event TimelineComment Actions We could emit a call to @llvm.objc.retain instead of the call to @llvm.objc.retainAutoreleasedReturnValue, but this doesn't seem to happen often and ARC optimizer can remove or replace the call anyway, so I'm just letting the front-end emit @llvm.objc.retainAutoreleasedReturnValue for simplicity. Comment Actions On second thought, I think we should emit a call to @llvm.objc.retain instead of a call to @llvm.objc.retainAutoreleasedReturnValue. I think we might want to remove ARC optimizer's code that converts calls to @llvm.objc.retainAutoreleasedReturnValue to calls to @llvm.objc.retain since it sometimes does the transformation when it shouldn't and we won't need that transformation once we switch to using the clang.arc.attachedcall operand bundle. Comment Actions Emit a call to @llvm.objc.retain instead of a call to @llvm.objc.retainAutoreleasedReturnValue. |