This is an archive of the discontinued LLVM Phabricator instance.

Support alias.scope and noalias metadata
ClosedPublic

Authored by nimiwio on Aug 10 2021, 2:34 PM.

Details

Summary

Introduces new Ops to represent 1. alias.scope metadata in LLVM, and 2. domains for these scopes. These correspond to the metadata described in https://llvm.org/docs/LangRef.html#noalias-and-alias-scope-metadata. Lists of scopes are modeled the same way as access groups - as an ArrayAttr on the Op (added in https://reviews.llvm.org/D97944).

Lowering 'noalias' attributes on function parameters is already supported. However, lowering noalias metadata on individual Ops is not, which is added in this change. LLVM uses the same keyword for these, but this change introduces a separate attribute name 'noalias_scopes' to represent this distinct concept.

Diff Detail

Event Timeline

nimiwio created this revision.Aug 10 2021, 2:34 PM
nimiwio requested review of this revision.Aug 10 2021, 2:34 PM
nimiwio updated this revision to Diff 365808.Aug 11 2021, 11:23 AM

Address clang-tidy warnings

mehdi_amini accepted this revision.Aug 18 2021, 1:13 AM

LG, only some nits. Thanks.

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
402–405

Could this be extracted somehow to reduce the template size (limit bloating?)
(or alternatively leave this in here, but extract everything else into a non-templated function called from here.

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
787

Nit: remove trivial braces.

798

Operation ?

805

If the type is easily spellable, it would likely be better than auto.
(probably worth taking another look at the other auto elsewhere)

807

(trivial braces here as well)

This revision is now accepted and ready to land.Aug 18 2021, 1:13 AM
nimiwio updated this revision to Diff 367332.Aug 18 2021, 2:58 PM
nimiwio marked 5 inline comments as done.

Address comments

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
402–405

Gave this a try - nicest way seemed to be a callback to verify the symbol type; Essentially your second suggestion.

@mehdi_amini Unless there are other comments, could you please commit this change?

This revision was automatically updated to reflect the committed changes.