File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
test/Transforms/InferAddressSpaces/SPIRV Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,11 @@ enum AddressSpace {
108108};
109109
110110unsigned SPIRVTargetMachine::getAssumedAddrSpace (const Value *V) const {
111+ // TODO: we only enable this for AMDGCN flavoured SPIR-V, where we know it to
112+ // be correct; this might be relaxed in the future.
113+ if (getTargetTriple ().getVendor () != Triple::VendorType::AMD)
114+ return UINT32_MAX;
115+
111116 const auto *LD = dyn_cast<LoadInst>(V);
112117 if (!LD)
113118 return UINT32_MAX;
@@ -127,6 +132,13 @@ unsigned SPIRVTargetMachine::getAssumedAddrSpace(const Value *V) const {
127132
128133std::pair<const Value *, unsigned >
129134SPIRVTargetMachine::getPredicatedAddrSpace (const Value *V) const {
135+ // TODO: this is only enabled for AMDGCN flavoured SPIR-V at the moment, where
136+ // we can rely on the intrinsics being available; we should re-implement it on
137+ // top of SPIR-V specific intrinsics if/when they are added or
138+ // OpGenericCastToPtrExplicit / OpGenericPtrMemSemantics directly.
139+ if (getTargetTriple ().getVendor () != Triple::VendorType::AMD)
140+ return std::pair (nullptr , UINT32_MAX);
141+
130142 using namespace PatternMatch ;
131143
132144 if (auto *II = dyn_cast<IntrinsicInst>(V)) {
Original file line number Diff line number Diff line change 1- ; RUN: opt -S -mtriple=spirv32-- -passes=infer-address-spaces -o - %s | FileCheck %s
2- ; RUN: opt -S -mtriple=spirv64-- -passes=infer-address-spaces -o - %s | FileCheck %s
1+ ; RUN: opt -S -mtriple=spirv64-amd-amdhsa -passes=infer-address-spaces -o - %s | FileCheck %s
32
43@c0 = addrspace (2 ) global ptr undef
54
You can’t perform that action at this time.
0 commit comments