Skip to content

Commit f2331fc

Browse files
committed
[TargetTransformInfo] Remove getFlatAddressSpace
This has been moved to `DataLayout`.
1 parent a4187bb commit f2331fc

File tree

7 files changed

+1
-45
lines changed

7 files changed

+1
-45
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
}

0 commit comments

Comments
 (0)