[PATCH] D21684: AMDGPU/SI: Simplify address space checks in AMDGPUDAGToDAGISel
Tom Stellard via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 24 07:59:21 PDT 2016
tstellarAMD created this revision.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
Herald added subscribers: kzhuravl, arsenm.
Get the address space directly from the MemSDNode rather than from
the value associated with the MemOperand. This was broken for the
case when the MemOperand was a PseudoSourceValue.
http://reviews.llvm.org/D21684
Files:
lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
Index: lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
+++ lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
@@ -73,8 +73,6 @@
bool FoldOperands(unsigned, const R600InstrInfo *, std::vector<SDValue> &);
bool FoldDotOperands(unsigned, const R600InstrInfo *, std::vector<SDValue> &);
- static bool checkType(const Value *ptr, unsigned int addrspace);
-
static bool isGlobalStore(const MemSDNode *N);
static bool isFlatStore(const MemSDNode *N);
static bool isLocalStore(const StoreSDNode *N);
@@ -227,8 +225,7 @@
SDNode *AMDGPUDAGToDAGISel::glueCopyToM0(SDNode *N) const {
if (Subtarget->getGeneration() < AMDGPUSubtarget::SOUTHERN_ISLANDS ||
- !checkType(cast<MemSDNode>(N)->getMemOperand()->getValue(),
- AMDGPUAS::LOCAL_ADDRESS))
+ cast<MemSDNode>(N)->getAddressSpace() != AMDGPUAS::LOCAL_ADDRESS)
return N;
const SITargetLowering& Lowering =
@@ -492,38 +489,25 @@
SelectCode(N);
}
-bool AMDGPUDAGToDAGISel::checkType(const Value *Ptr, unsigned AS) {
- assert(AS != 0 && "Use checkPrivateAddress instead.");
- if (!Ptr)
- return false;
-
- return Ptr->getType()->getPointerAddressSpace() == AS;
-}
-
bool AMDGPUDAGToDAGISel::isGlobalStore(const MemSDNode *N) {
- if (!N->writeMem())
- return false;
- return checkType(N->getMemOperand()->getValue(), AMDGPUAS::GLOBAL_ADDRESS);
+ return N->writeMem() && N->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS;
}
bool AMDGPUDAGToDAGISel::isLocalStore(const StoreSDNode *N) {
- return checkType(N->getMemOperand()->getValue(), AMDGPUAS::LOCAL_ADDRESS);
+ return N->writeMem() && N->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS;
}
bool AMDGPUDAGToDAGISel::isFlatStore(const MemSDNode *N) {
- if (!N->writeMem())
- return false;
- return checkType(N->getMemOperand()->getValue(), AMDGPUAS::FLAT_ADDRESS);
+ return N->writeMem() && N->getAddressSpace() == AMDGPUAS::FLAT_ADDRESS;
}
bool AMDGPUDAGToDAGISel::isConstantLoad(const MemSDNode *N, int CbId) const {
if (!N->readMem())
return false;
- const Value *MemVal = N->getMemOperand()->getValue();
if (CbId == -1)
- return checkType(MemVal, AMDGPUAS::CONSTANT_ADDRESS);
+ return N->getAddressSpace() == AMDGPUAS::CONSTANT_ADDRESS;
- return checkType(MemVal, AMDGPUAS::CONSTANT_BUFFER_0 + CbId);
+ return N->getAddressSpace() == AMDGPUAS::CONSTANT_BUFFER_0 + CbId;
}
bool AMDGPUDAGToDAGISel::isGlobalLoad(const MemSDNode *N) const {
@@ -539,17 +523,15 @@
return true;
}
- return checkType(N->getMemOperand()->getValue(), AMDGPUAS::GLOBAL_ADDRESS);
+ return N->getAddressSpace() == AMDGPUAS::GLOBAL_ADDRESS;
}
bool AMDGPUDAGToDAGISel::isLocalLoad(const LoadSDNode *N) const {
- return checkType(N->getMemOperand()->getValue(), AMDGPUAS::LOCAL_ADDRESS);
+ return N->readMem() && N->getAddressSpace() == AMDGPUAS::LOCAL_ADDRESS;
}
bool AMDGPUDAGToDAGISel::isFlatLoad(const MemSDNode *N) const {
- if (!N->readMem())
- return false;
- return checkType(N->getMemOperand()->getValue(), AMDGPUAS::FLAT_ADDRESS);
+ return N->readMem() && N->getAddressSpace() == AMDGPUAS::FLAT_ADDRESS;
}
bool AMDGPUDAGToDAGISel::isUniformBr(const SDNode *N) const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21684.61790.patch
Type: text/x-patch
Size: 3288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160624/7b396616/attachment.bin>
More information about the llvm-commits
mailing list