Skip to content

Commit 39677a2

Browse files
committed
fix comments from matthew
1 parent 1363d4e commit 39677a2

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12781,7 +12781,7 @@ struct AAAddressSpaceCallSiteArgument final : AAAddressSpaceImpl {
1278112781
} // namespace
1278212782

1278312783
/// ------------------------ No Alias Address Space ---------------------------
12784-
// This attrubte assumes flat address space can alias all other address space
12784+
// This attribute assumes flat address space can alias all other address space
1278512785
namespace {
1278612786
struct AANoAliasAddrSpaceImpl : public AANoAliasAddrSpace {
1278712787
AANoAliasAddrSpaceImpl(const IRPosition &IRP, Attributor &A)
@@ -12848,6 +12848,8 @@ struct AANoAliasAddrSpaceImpl : public AANoAliasAddrSpace {
1284812848
MDNode *NoAliasASNode = nullptr;
1284912849
MDBuilder MDB(Ctx);
1285012850
for (RangeMap::const_iterator I = Map.begin(); I != Map.end(); I++) {
12851+
if (I.value() != true)
12852+
continue;
1285112853
unsigned Upper = I.stop();
1285212854
unsigned Lower = I.start();
1285312855
if (NoAliasASNode == nullptr) {
@@ -12861,7 +12863,7 @@ struct AANoAliasAddrSpaceImpl : public AANoAliasAddrSpace {
1286112863
Value *AssociatedValue = &getAssociatedValue();
1286212864
bool Changed = false;
1286312865

12864-
auto Pred = [&](const Use &U, bool &) {
12866+
auto AddNoAliasAttr = [&](const Use &U, bool &) {
1286512867
if (U.get() != AssociatedValue)
1286612868
return true;
1286712869
auto *Inst = dyn_cast<Instruction>(U.getUser());
@@ -12876,8 +12878,8 @@ struct AANoAliasAddrSpaceImpl : public AANoAliasAddrSpace {
1287612878
Changed = true;
1287712879
return true;
1287812880
};
12879-
(void)A.checkForAllUses(Pred, *this, getAssociatedValue(),
12880-
/* CheckBBLivenessOnly=*/true);
12881+
(void)A.checkForAllUses(AddNoAliasAttr, *this, getAssociatedValue(),
12882+
/*CheckBBLivenessOnly=*/true);
1288112883
return Changed ? ChangeStatus::CHANGED : ChangeStatus::UNCHANGED;
1288212884
}
1288312885

llvm/test/CodeGen/AMDGPU/attributor-noalias-addrspace.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
22
; RUN: opt -S -mtriple=amdgcn-amd-amdhsa -passes=amdgpu-attributor %s | FileCheck %s
33

4-
@gptr = protected addrspace(1) externally_initialized global i32 0, align 4
5-
@gptr2 = protected addrspace(4) externally_initialized global i32 0, align 4
6-
@gptr3 = protected addrspace(3) externally_initialized global i32 0, align 4
4+
@gptr = addrspace(1) externally_initialized global i32 0, align 4
5+
@gptr2 = addrspace(4) externally_initialized global i32 0, align 4
6+
@gptr3 = addrspace(3) externally_initialized global i32 0, align 4
77

88
define amdgpu_kernel void @no_alias_addr_space_select(ptr addrspace(3) %sptr, i1 %cond1, i1 %cond2, i32 %val, i32 %offset) #0 {
99
; CHECK-LABEL: define amdgpu_kernel void @no_alias_addr_space_select(

0 commit comments

Comments
 (0)