ahatanak added a comment.

In D86049#3819109 <https://reviews.llvm.org/D86049#3819109>, @mwyman wrote:

> In D86049#3818981 <https://reviews.llvm.org/D86049#3818981>, @plotfi wrote:
>
>> @ahatanak I can revive some of what I was working on from 
>> https://reviews.llvm.org/D86049?id=285923 if we think we need a thunk for 
>> the checks as @rjmccall mentioned.
>
> I believe the generated direct methods already handle the null checks and 
> class init in `CGObjCCommonMac::GenerateDirectMethodPrologue`, meaning the 
> thunks aren't strictly necessary for the callee to handle them.

I don't know exactly what the thunk is supposed to do, but it sounds like the 
thunk is going to do the initialization by calling `objc_opt_self` and then 
call the direct class method. So the initialization isn't done inside the 
direct method.

If the thunk is inlined, the call to `objc_opt_self` can be optimized away if 
it we can prove `self` is already initialized. But we'd have to teach llvm to 
remove the call to `objc_opt_self` or add a new optimization pass to do so (see 
https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGObjCMac.cpp#L4057).

John, is that what you had in mind?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86049/new/

https://reviews.llvm.org/D86049

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to