Skip to content

Commit da08c3a

Browse files
committed
add getFlatAddressSpace
1 parent 6356b15 commit da08c3a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ void SPIRVPassConfig::addIRPasses() {
196196
// address space casts that can be removed.
197197
// If an address space cast is not removed while targeting Vulkan, lowering
198198
// will fail during MIR lowering.
199-
addPass(createInferAddressSpacesPass(/* AddressSpace= */ 0));
199+
addPass(createInferAddressSpacesPass());
200200

201201
// 1. Simplify loop for subsequent transformations. After this steps, loops
202202
// have the following properties:

llvm/lib/Target/SPIRV/SPIRVTargetTransformInfo.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ class SPIRVTTIImpl : public BasicTTIImplBase<SPIRVTTIImpl> {
4848
return TTI::PSK_Software; // Arbitrary bit-width INT is not core SPIR-V.
4949
return TTI::PSK_FastHardware;
5050
}
51+
52+
unsigned getFlatAddressSpace() const {
53+
if (ST->isVulkanEnv())
54+
return 0;
55+
// FIXME: Clang has 2 distinct address space maps. One where
56+
// default=4=Generic, and one with default=0=Function. This depends on the
57+
// environment. For OpenCL, we don't need to run the InferAddrSpace pass, so
58+
// we can return -1, but we might want to fix this.
59+
return -1;
60+
}
5161
};
5262

5363
} // namespace llvm

0 commit comments

Comments
 (0)