[PATCH] [CodeGen] tighten objc ivar invariant.load attribution

John McCall rjmccall at apple.com
Fri Feb 15 16:54:28 PST 2013


On Feb 14, 2013, at 3:14 PM, Saleem Abdulrasool <compnerd at compnerd.org> wrote:
> On Thu, Feb 14, 2013 at 11:23 AM, John McCall <rjmccall at apple.com> wrote:
>> On Feb 14, 2013, at 9:37 AM, Saleem Abdulrasool <compnerd at compnerd.org> wrote:
>>> Add a few test cases and fix an inverted check.
>>> 
>>> Hi rjmccall,
>>> 
>>> http://llvm-reviews.chandlerc.com/D406
>>> 
>>> CHANGE SINCE LAST DIFF
>>> http://llvm-reviews.chandlerc.com/D406?vs=976&id=982#toc
>>> 
>>> Files:
>>> lib/CodeGen/CGObjCMac.cpp
>>> test/CodeGenObjC/ivar-invariant-unimplemented.m
>>> test/CodeGenObjC/ivar-invariant.m
>>> 
>>> Index: lib/CodeGen/CGObjCMac.cpp
>>> ===================================================================
>>> --- lib/CodeGen/CGObjCMac.cpp
>>> +++ lib/CodeGen/CGObjCMac.cpp
>>> @@ -6449,10 +6449,23 @@
>>>                                               unsigned CVRQualifiers) {
>>>  ObjCInterfaceDecl *ID = ObjectTy->getAs<ObjCObjectType>()->getInterface();
>>>  llvm::Value *Offset = EmitIvarOffset(CGF, ID, Ivar);
>>> +
>>> +  // Annotate the load as an invariant load iff the object type is the type, or
>>> +  // a derived type, of the class containing the ivar within an ObjC method.
>>> +  // This check is needed because the ivar offset is a lazily initialised value
>>> +  // that may depend on objc_msgSend to perform a fixup on the first message
>>> +  // dispatch.
>>> +  //
>>> +  // An additional opportunity to mark the load as invariant arises when the
>>> +  // base of the ivar access is a parameter to an Objective C method.  However,
>>> +  // because the parameters are not available in the current interface, we
>>> +  // cannot perform this check.
>> 
>> Go ahead and tweak the interface to propagate through an optional
>> base expression and then implement your check based on that.
> 
> Do you mind if I were to do that as a follow on change?

No, that's fine.

Do you need a commit?

John.



More information about the cfe-commits mailing list