Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
IIUC, we sometimes turn -retain message sends into calls to objc_retain and so on. Outside of ARC (the only time they're valid), these calls don't have the semantics of guaranteeing to return their self argument. So I think this change is only fine if we're not applying it when doing that non-ARC transformation.
Add a note/check to the [x retain] => objc_retain(x) test explaining why it shouldn't be lowered as an intrinsic call in the future.
I believe this is covered now. The -retain => objc_retain transformation emits normal function calls, and objc_retain calls are only transformed into intrinsic calls when ARC is enabled.
Okay, thanks, seems like a good approach.
clang/test/CodeGenObjC/convert-messages-to-runtime-calls.m | ||
---|---|---|
34 ↗ | (On Diff #364215) | This only actually tests for the absence of these lines between the CHECK-LABEL and the first CALLS line below, so I don't think it does much. |
Rebased.
Also, turns out that stripPointerCasts() can see through the thisreturn attribute, which defeats a self retain optimization, breaking one of the clang tests. I tweaked a callback to make it configurable. Let me know if you see a better way of dealing with that.
How does stripPointerCasts "see through" an attribute on the underlying call instruction?
Whoa. That does not seem like it's in the contract for stripPointerCasts() generically. At best that should be enabled by the strip kind.
Move the stripPointerCasts() change into its own review: https://reviews.llvm.org/D156735