[PATCH 5/5] R600: Don't create private AS copies of global variables
Jan Vesely
jan.vesely at rutgers.edu
Mon Jun 8 08:57:29 PDT 2015
On Mon, May 25, 2015 at 9:13 PM, Matt Arsenault <Matthew.Arsenault at amd.com>
wrote:
>
> On May 25, 2015, at 5:08 PM, Jan Vesely <jan.vesely at rutgers.edu> wrote:
>
> Needs mesa patch. Loads from gloabl variables use VTX2,
> all other loads from constant AAS are converted to Global AS loads in the
> earlier commit.
>
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
> lib/Target/R600/AMDGPUISelLowering.cpp | 37 +--------------
> lib/Target/R600/R600ISelLowering.cpp | 9 +---
> test/CodeGen/R600/gv-const-addrspace-complex.ll | 63
> +++++++++++++++++++++++++
> test/CodeGen/R600/gv-const-addrspace-fail.ll | 57 ----------------------
> test/CodeGen/R600/gv-const-addrspace.ll | 25 +++++-----
> 5 files changed, 78 insertions(+), 113 deletions(-)
> create mode 100644 test/CodeGen/R600/gv-const-addrspace-complex.ll
> delete mode 100644 test/CodeGen/R600/gv-const-addrspace-fail.ll
>
> diff --git a/lib/Target/R600/AMDGPUISelLowering.cpp
> b/lib/Target/R600/AMDGPUISelLowering.cpp
> index 3d3a53c..9483bff 100644
> --- a/lib/Target/R600/AMDGPUISelLowering.cpp
> +++ b/lib/Target/R600/AMDGPUISelLowering.cpp
> @@ -801,43 +801,8 @@ SDValue
> AMDGPUTargetLowering::LowerGlobalAddress(AMDGPUMachineFunction* MFI,
> getPointerTy(AMDGPUAS::LOCAL_ADDRESS));
> }
> case AMDGPUAS::CONSTANT_ADDRESS: {
> - MachineFrameInfo *FrameInfo = DAG.getMachineFunction().getFrameInfo();
> - Type *EltType = GV->getType()->getElementType();
> - unsigned Size = TD->getTypeAllocSize(EltType);
> - unsigned Alignment = TD->getPrefTypeAlignment(EltType);
> -
> - MVT PrivPtrVT = getPointerTy(AMDGPUAS::PRIVATE_ADDRESS);
> MVT ConstPtrVT = getPointerTy(AMDGPUAS::CONSTANT_ADDRESS);
> -
> - int FI = FrameInfo->CreateStackObject(Size, Alignment, false);
> - SDValue InitPtr = DAG.getFrameIndex(FI, PrivPtrVT);
> -
> - const GlobalVariable *Var = cast<GlobalVariable>(GV);
> - if (!Var->hasInitializer()) {
> - // This has no use, but bugpoint will hit it.
> - return DAG.getZExtOrTrunc(InitPtr, SDLoc(Op), ConstPtrVT);
> - }
> -
> - const Constant *Init = Var->getInitializer();
> - SmallVector<SDNode*, 8> WorkList;
> -
> - for (SDNode::use_iterator I = DAG.getEntryNode()->use_begin(),
> - E = DAG.getEntryNode()->use_end(); I != E;
> ++I) {
> - if (I->getOpcode() != AMDGPUISD::REGISTER_LOAD && I->getOpcode() !=
> ISD::LOAD)
> - continue;
> - WorkList.push_back(*I);
> - }
> - SDValue Chain = LowerConstantInitializer(Init, GV, InitPtr,
> DAG.getEntryNode(), DAG);
> - for (SmallVector<SDNode*, 8>::iterator I = WorkList.begin(),
> - E = WorkList.end(); I != E;
> ++I) {
> - SmallVector<SDValue, 8> Ops;
> - Ops.push_back(Chain);
> - for (unsigned i = 1; i < (*I)->getNumOperands(); ++i) {
> - Ops.push_back((*I)->getOperand(i));
> - }
> - DAG.UpdateNodeOperands(*I, Ops);
> - }
> - return DAG.getZExtOrTrunc(InitPtr, SDLoc(Op), ConstPtrVT);
> + return DAG.getConstant(0, SDLoc(Op), ConstPtrVT);
> }
> }
>
> diff --git a/lib/Target/R600/R600ISelLowering.cpp
> b/lib/Target/R600/R600ISelLowering.cpp
> index 33909bf..49aba16 100644
> --- a/lib/Target/R600/R600ISelLowering.cpp
> +++ b/lib/Target/R600/R600ISelLowering.cpp
> @@ -1474,14 +1474,7 @@ SDValue R600TargetLowering::LowerLOAD(SDValue Op,
> SelectionDAG &DAG) const
> if (isa<GlobalVariable>(GetUnderlyingObject(
> LoadNode->getMemOperand()->getValue(), *getDataLayout()))) {
>
>
> Can we get rid of this check for GetUnderlyingObject? It’s not really
> reliable, it’s possible to confuse this with a select on on a pointer for
> example
>
Is there any other way to know whether a const AS load target is RO data or
user provided const buffer?
jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150608/c7770a1f/attachment.html>
More information about the llvm-commits
mailing list