llvm.org GIT mirror llvm / 5ee5d45
R600/SI: Fix losing chain when fixing reg class of loads. The lost chain resulting in earlier side effecting nodes being deleted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217561 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 6 years ago
2 changed file(s) with 40 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
20032003 return N;
20042004 }
20052005 ConstantSDNode *Offset = cast(N->getOperand(1));
2006 SDValue Ops[] = {
2007 SDValue(DAG.getMachineNode(AMDGPU::SI_ADDR64_RSRC, DL, MVT::i128,
2008 DAG.getConstant(0, MVT::i64)), 0),
2009 N->getOperand(0),
2010 DAG.getConstant(Offset->getSExtValue() << 2, MVT::i32)
2011 };
2006 MachineSDNode *RSrc = DAG.getMachineNode(AMDGPU::SI_ADDR64_RSRC, DL,
2007 MVT::i128,
2008 DAG.getConstant(0, MVT::i64));
2009
2010 SmallVector Ops;
2011 Ops.push_back(SDValue(RSrc, 0));
2012 Ops.push_back(N->getOperand(0));
2013 Ops.push_back(DAG.getConstant(Offset->getSExtValue() << 2, MVT::i32));
2014
2015 // Copy remaining operands so we keep any chain and glue nodes that follow
2016 // the normal operands.
2017 for (unsigned I = 2, E = N->getNumOperands(); I != E; ++I)
2018 Ops.push_back(N->getOperand(I));
2019
20122020 return DAG.getMachineNode(NewOpcode, DL, N->getVTList(), Ops);
20132021 }
20142022 }
0 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=FUNC -check-prefix=SI %s
1
2 @ptr_load = addrspace(3) global i32 addrspace(2)* null, align 8
3
4 ; Make sure when the load from %ptr2 is folded the chain isn't lost,
5 ; resulting in losing the store to gptr
6
7 ; FUNC-LABEL: @missing_store_reduced
8 ; SI: DS_READ_B64
9 ; SI: BUFFER_STORE_DWORD
10 ; SI: BUFFER_LOAD_DWORD
11 ; SI: BUFFER_STORE_DWORD
12 ; SI: S_ENDPGM
13 define void @missing_store_reduced(i32 addrspace(1)* %out, i32 addrspace(1)* %gptr) #0 {
14 %ptr0 = load i32 addrspace(2)* addrspace(3)* @ptr_load, align 8
15 %ptr2 = getelementptr inbounds i32 addrspace(2)* %ptr0, i64 2
16
17 store i32 99, i32 addrspace(1)* %gptr, align 4
18 %tmp2 = load i32 addrspace(2)* %ptr2, align 4
19
20 store i32 %tmp2, i32 addrspace(1)* %out, align 4
21 ret void
22 }
23
24 attributes #0 = { nounwind }
25