Posts

Showing posts from September, 2021

Working with alias.scope and noalias metadata in LLVM

This post briefly talks about the ScopedNoAlias alias-analysis pass in LLVM. It demonstrates the code snippets to attach, read and remove the metadata related to the ScopedNoAlias alias-analysis pass. It also talks about how the metadata is interpreted by the ScopedNoAlias alias-analysis pass. The ScopedNoAlias alias-analysis pass in LLVM is used to determine whether a pair of pointers can alias with respect to the domains. A domain consists of multiple scopes and is defined by an id and an optional descriptive string. A scope consists of an id, a domain, and an optional descriptive string. The list of scopes can be specified using the alias.scope and noalias metadata. Metadata is essentially some additional information that is used by optimization passes. The alias.scope and noalias metadata can be attached to the load and store instructions. The ScopedNoAlias alias-analysis pass relies on the alias.scope and noalias metadata to infer the alias result for a given pair of pointers.