Skip to content

Commit 3541dca

Browse files
committed
[TargetTransformInfo] Remove getFlatAddressSpace
This has been moved to `DataLayout`.
1 parent 3052d9a commit 3541dca

File tree

11 files changed

+5
-49
lines changed

11 files changed

+5
-49
lines changed

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -451,24 +451,6 @@ class TargetTransformInfo {
451451
/// Return false if a \p AS0 address cannot possibly alias a \p AS1 address.
452452
bool addrspacesMayAlias(unsigned AS0, unsigned AS1) const;
453453

454-
/// Returns the address space ID for a target's 'flat' address space. Note
455-
/// this is not necessarily the same as addrspace(0), which LLVM sometimes
456-
/// refers to as the generic address space. The flat address space is a
457-
/// generic address space that can be used access multiple segments of memory
458-
/// with different address spaces. Access of a memory location through a
459-
/// pointer with this address space is expected to be legal but slower
460-
/// compared to the same memory location accessed through a pointer with a
461-
/// different address space.
462-
//
463-
/// This is for targets with different pointer representations which can
464-
/// be converted with the addrspacecast instruction. If a pointer is converted
465-
/// to this address space, optimizations should attempt to replace the access
466-
/// with the source address space.
467-
///
468-
/// \returns ~0u if the target does not have such a flat address space to
469-
/// optimize away.
470-
unsigned getFlatAddressSpace() const;
471-
472454
/// Return any intrinsic address operand indexes which may be rewritten if
473455
/// they use a flat address space pointer.
474456
///
@@ -1838,7 +1820,6 @@ class TargetTransformInfo::Concept {
18381820
virtual bool isAlwaysUniform(const Value *V) = 0;
18391821
virtual bool isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const = 0;
18401822
virtual bool addrspacesMayAlias(unsigned AS0, unsigned AS1) const = 0;
1841-
virtual unsigned getFlatAddressSpace() = 0;
18421823
virtual bool collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
18431824
Intrinsic::ID IID) const = 0;
18441825
virtual bool isNoopAddrSpaceCast(unsigned FromAS, unsigned ToAS) const = 0;
@@ -2266,8 +2247,6 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
22662247
return Impl.addrspacesMayAlias(AS0, AS1);
22672248
}
22682249

2269-
unsigned getFlatAddressSpace() override { return Impl.getFlatAddressSpace(); }
2270-
22712250
bool collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
22722251
Intrinsic::ID IID) const override {
22732252
return Impl.collectFlatAddressOperands(OpIndexes, IID);

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ class TargetTransformInfoImplBase {
115115
return true;
116116
}
117117

118-
unsigned getFlatAddressSpace() const { return -1; }
119-
120118
bool collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
121119
Intrinsic::ID IID) const {
122120
return false;

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,6 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
292292
return true;
293293
}
294294

295-
unsigned getFlatAddressSpace() {
296-
// Return an invalid address space.
297-
return -1;
298-
}
299-
300295
bool collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
301296
Intrinsic::ID IID) const {
302297
return false;

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,6 @@ bool llvm::TargetTransformInfo::addrspacesMayAlias(unsigned FromAS,
305305
return TTIImpl->addrspacesMayAlias(FromAS, ToAS);
306306
}
307307

308-
unsigned TargetTransformInfo::getFlatAddressSpace() const {
309-
return TTIImpl->getFlatAddressSpace();
310-
}
311-
312308
bool TargetTransformInfo::collectFlatAddressOperands(
313309
SmallVectorImpl<int> &OpIndexes, Intrinsic::ID IID) const {
314310
return TTIImpl->collectFlatAddressOperands(OpIndexes, IID);

llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,6 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
200200
return AMDGPU::addrspacesMayAlias(AS0, AS1);
201201
}
202202

203-
unsigned getFlatAddressSpace() const {
204-
// Don't bother running InferAddressSpaces pass on graphics shaders which
205-
// don't use flat addressing.
206-
if (IsGraphics)
207-
return -1;
208-
return AMDGPUAS::FLAT_ADDRESS;
209-
}
210-
211203
bool collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
212204
Intrinsic::ID IID) const;
213205

llvm/lib/Target/NVPTX/NVPTXTargetTransformInfo.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ class NVPTXTTIImpl : public BasicTTIImplBase<NVPTXTTIImpl> {
4545

4646
bool isSourceOfDivergence(const Value *V);
4747

48-
unsigned getFlatAddressSpace() const {
49-
return AddressSpace::ADDRESS_SPACE_GENERIC;
50-
}
51-
5248
bool canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS) const {
5349
return AS != AddressSpace::ADDRESS_SPACE_SHARED &&
5450
AS != AddressSpace::ADDRESS_SPACE_LOCAL && AS != ADDRESS_SPACE_PARAM;

llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ bool InferAddressSpacesImpl::run(Function &CurFn) {
854854
FlatAddrSpace = 0;
855855

856856
if (FlatAddrSpace == UninitializedAddressSpace) {
857-
FlatAddrSpace = TTI->getFlatAddressSpace();
857+
FlatAddrSpace = DL->getFlatAddressSpace();
858858
if (FlatAddrSpace == UninitializedAddressSpace)
859859
return false;
860860
}

llvm/test/Transforms/InferAddressSpaces/AMDGPU/noop-ptrint-pair.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: opt -mtriple=amdgcn-amd-amdhsa -S -o - -passes=infer-address-spaces %s | FileCheck -check-prefixes=COMMON,AMDGCN %s
22
; RUN: opt -S -o - -passes=infer-address-spaces -assume-default-is-flat-addrspace %s | FileCheck -check-prefixes=COMMON,NOTTI %s
33

4-
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-ni:7:8"
4+
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-ni:7:8-T0"
55

66
; COMMON-LABEL: @noop_ptrint_pair(
77
; AMDGCN-NEXT: store i32 0, ptr addrspace(1) %{{.*}}

llvm/test/Transforms/InferAddressSpaces/AMDGPU/old-pass-regressions-inseltpoison.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -data-layout=A5 -S -mtriple=amdgcn-amd-amdhsa -passes=infer-address-spaces %s | FileCheck %s
1+
; RUN: opt -data-layout=A5-T0 -S -mtriple=amdgcn-amd-amdhsa -passes=infer-address-spaces %s | FileCheck %s
22

33
; Regression tests from old HSAIL addrspacecast optimization pass
44

llvm/test/Transforms/InferAddressSpaces/AMDGPU/old-pass-regressions.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; RUN: opt -data-layout=A5 -S -mtriple=amdgcn-amd-amdhsa -passes=infer-address-spaces %s | FileCheck %s
1+
; RUN: opt -data-layout=A5-T0 -S -mtriple=amdgcn-amd-amdhsa -passes=infer-address-spaces %s | FileCheck %s
22

33
; Regression tests from old HSAIL addrspacecast optimization pass
44

0 commit comments

Comments
 (0)