[llvm] [AMDGPU] Allow casts between the Global and Constant Addr Spaces in isValidAddrSpaceCast (PR #112493)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 19 06:33:21 PDT 2024
================
@@ -174,24 +174,45 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
bool isAlwaysUniform(const Value *V) const;
bool isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const {
- if (ToAS == AMDGPUAS::FLAT_ADDRESS) {
- switch (FromAS) {
+ // Address space casts must cast between different address spaces.
+ if (FromAS == ToAS)
+ return false;
+
+ if (FromAS == AMDGPUAS::FLAT_ADDRESS ||
+ FromAS == AMDGPUAS::GLOBAL_ADDRESS ||
+ FromAS == AMDGPUAS::CONSTANT_ADDRESS ||
+ FromAS > AMDGPUAS::MAX_AMDGPU_ADDRESS) {
----------------
arsenm wrote:
Use AMDGPU::isFlatGlobalAddrSpace instead of repeating it
https://github.com/llvm/llvm-project/pull/112493
More information about the llvm-commits
mailing list