[all-commits] [llvm/llvm-project] cbdf62: [AMDGPU] Correctly merge alias.scope and noalias m...

bcahoon via All-commits all-commits at lists.llvm.org
Tue Sep 21 11:06:52 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cbdf624bb82b57dc9372353459cb04e615418697
      https://github.com/llvm/llvm-project/commit/cbdf624bb82b57dc9372353459cb04e615418697
  Author: Brendon Cahoon <brendon.cahoon at amd.com>
  Date:   2021-09-21 (Tue, 21 Sep 2021)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
    A llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa-memcpy.ll
    M llvm/test/CodeGen/AMDGPU/lower-lds-struct-aa-merge.ll

  Log Message:
  -----------
  [AMDGPU] Correctly merge alias.scope and noalias metadata for memops

When adding alias.scope and noalias metadata to a memcpy function,
the alias.scope and noalias metadata from the operands are merged.
The rule for merging alias.scope is to take the intersection of
the domains and the union of the scopes within those domains.
The rule for merging noalias is to take the intersection.

The bug is that AMDGPULowerModuleLDS was using concatenation for
both alias.scope and noalias. For example, when f1 and f2 are added
to the LDS structure and there is a memcpy(f2, f1, sizeof(f1)).
Then, concatenation creates noalias metadata for the memcpy that
includes both {f1, f2}. That means that the memcpy is assumed
not to alias a prior load of f2, which enables the optimizer to
remove a load of f2 that occurs after mempcy.

The function MDNode::getmostGenericAliasScope defines the semantics
for alias.scope. There is a function, combineMetadata in Local.cpp,
that uses intersect for noalias.

Differential Revision: https://reviews.llvm.org/D110049




More information about the All-commits mailing list