[llvm] 2766a66 - [AMDGPU] Remove FlatVariant argument from isLegalFlatAddressingMode. NFC. (#93938)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 01:58:16 PDT 2024
Author: Stanislav Mekhanoshin
Date: 2024-05-31T01:58:12-07:00
New Revision: 2766a66fa777bbb654e08ccbcfdc3e61b70ba015
URL: https://github.com/llvm/llvm-project/commit/2766a66fa777bbb654e08ccbcfdc3e61b70ba015
DIFF: https://github.com/llvm/llvm-project/commit/2766a66fa777bbb654e08ccbcfdc3e61b70ba015.diff
LOG: [AMDGPU] Remove FlatVariant argument from isLegalFlatAddressingMode. NFC. (#93938)
This argument is easily deduced from AS argument.
Added:
Modified:
llvm/lib/Target/AMDGPU/SIISelLowering.cpp
llvm/lib/Target/AMDGPU/SIISelLowering.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index f9948e92862f7..7cde09cc0b1cf 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1484,14 +1484,18 @@ bool SITargetLowering::getAddrModeArguments(IntrinsicInst *II,
}
bool SITargetLowering::isLegalFlatAddressingMode(const AddrMode &AM,
- unsigned AddrSpace,
- uint64_t FlatVariant) const {
+ unsigned AddrSpace) const {
if (!Subtarget->hasFlatInstOffsets()) {
// Flat instructions do not have offsets, and only have the register
// address.
return AM.BaseOffs == 0 && AM.Scale == 0;
}
+ decltype(SIInstrFlags::FLAT) FlatVariant =
+ AddrSpace == AMDGPUAS::GLOBAL_ADDRESS ? SIInstrFlags::FlatGlobal
+ : AddrSpace == AMDGPUAS::PRIVATE_ADDRESS ? SIInstrFlags::FlatScratch
+ : SIInstrFlags::FLAT;
+
return AM.Scale == 0 &&
(AM.BaseOffs == 0 || Subtarget->getInstrInfo()->isLegalFLATOffset(
AM.BaseOffs, AddrSpace, FlatVariant));
@@ -1499,8 +1503,7 @@ bool SITargetLowering::isLegalFlatAddressingMode(const AddrMode &AM,
bool SITargetLowering::isLegalGlobalAddressingMode(const AddrMode &AM) const {
if (Subtarget->hasFlatGlobalInsts())
- return isLegalFlatAddressingMode(AM, AMDGPUAS::GLOBAL_ADDRESS,
- SIInstrFlags::FlatGlobal);
+ return isLegalFlatAddressingMode(AM, AMDGPUAS::GLOBAL_ADDRESS);
if (!Subtarget->hasAddr64() || Subtarget->useFlatForGlobal()) {
// Assume the we will use FLAT for all global memory accesses
@@ -1512,8 +1515,7 @@ bool SITargetLowering::isLegalGlobalAddressingMode(const AddrMode &AM) const {
// by setting the stride value in the resource descriptor which would
// increase the size limit to (stride * 4GB). However, this is risky,
// because it has never been validated.
- return isLegalFlatAddressingMode(AM, AMDGPUAS::FLAT_ADDRESS,
- SIInstrFlags::FLAT);
+ return isLegalFlatAddressingMode(AM, AMDGPUAS::FLAT_ADDRESS);
}
return isLegalMUBUFAddressingMode(AM);
@@ -1619,8 +1621,7 @@ bool SITargetLowering::isLegalAddressingMode(const DataLayout &DL,
if (AS == AMDGPUAS::PRIVATE_ADDRESS)
return Subtarget->enableFlatScratch()
- ? isLegalFlatAddressingMode(AM, AMDGPUAS::PRIVATE_ADDRESS,
- SIInstrFlags::FlatScratch)
+ ? isLegalFlatAddressingMode(AM, AMDGPUAS::PRIVATE_ADDRESS)
: isLegalMUBUFAddressingMode(AM);
if (AS == AMDGPUAS::LOCAL_ADDRESS ||
@@ -1647,8 +1648,7 @@ bool SITargetLowering::isLegalAddressingMode(const DataLayout &DL,
// computation. We don't have instructions that compute pointers with any
// addressing modes, so treat them as having no offset like flat
// instructions.
- return isLegalFlatAddressingMode(AM, AMDGPUAS::FLAT_ADDRESS,
- SIInstrFlags::FLAT);
+ return isLegalFlatAddressingMode(AM, AMDGPUAS::FLAT_ADDRESS);
}
// Assume a user alias of global for unknown address spaces.
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.h b/llvm/lib/Target/AMDGPU/SIISelLowering.h
index 292b17da93583..c5f3a98e69061 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.h
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.h
@@ -223,8 +223,7 @@ class SITargetLowering final : public AMDGPUTargetLowering {
SDValue performClampCombine(SDNode *N, DAGCombinerInfo &DCI) const;
SDValue performRcpCombine(SDNode *N, DAGCombinerInfo &DCI) const;
- bool isLegalFlatAddressingMode(const AddrMode &AM, unsigned AddrSpace,
- uint64_t FlatVariant) const;
+ bool isLegalFlatAddressingMode(const AddrMode &AM, unsigned AddrSpace) const;
bool isLegalMUBUFAddressingMode(const AddrMode &AM) const;
unsigned isCFIntrinsic(const SDNode *Intr) const;
More information about the llvm-commits
mailing list