fhahn marked an inline comment as done.
fhahn added inline comments.

================
Comment at: clang/lib/CodeGen/CGCall.cpp:2198
+        // reference to the underlying object. Mark it accordingly.
+        Attrs.addAttribute(llvm::Attribute::NoAlias);
+
----------------
rjmccall wrote:
> fhahn wrote:
> > rjmccall wrote:
> > > This definitely can't be added unconditionally to all types; you need to 
> > > rule out non-trivial C++ class types, as well as types with ObjC weak 
> > > references.
> > Updated to rule out non trivially-copyable types.
> > 
> > I am not sure how to best handle types with weak references. I did not 
> > manage to find any helpers that traverse a whole type to check if it 
> > contains weak references. 
> > 
> > I added `clang/test/CodeGenObjC/pass-by-value-noalias.m` and IIUC `noalias` 
> > should not be added for that case.
> The restriction should not be by triviality but by whether indirectness is 
> forced semantically.  That may currently only be available on RecordDecl (as 
> `RecordDecl::getArgPassingRestrictions`), but you could definitely add an 
> accessor to `Type` which checked for a RecordType and otherwise returned that 
> there are no passing constraints.  Tagging Akira, who worked on this.
Thanks John, that does indeed exactly what we need I think. I updated the code 
to use `getAsRecordDecl` here. I can also add a helper to Type if it is useful 
beyond here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85473

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

Reply via email to