Skip to content

Commit 024ad3e

Browse files
rampitecsearlmc1
authored andcommitted
[AMDGPU] Produce better memoperand for LDS DMA (llvm#75247)
1) It was marked as volatile. This is not needed and the only reason it was done is because it is both load and store and handled together with atomics. Global load to LDS was marked as volatile just because buffer load was done that way. 2) Preserve at least LDS (store) pointer which we always have with the intrinsics. 3) Use PoisonValue instead of nullptr for load memop as a Value. Change-Id: I3f937cff3280a411653712357a144d5ce819fea6
1 parent 18c72ae commit 024ad3e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,18 +1091,18 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
10911091
MachineMemOperand::MOStore |
10921092
MachineMemOperand::MODereferenceable;
10931093

1094-
// XXX - Should this be volatile without known ordering?
1095-
Info.flags |= MachineMemOperand::MOVolatile;
1096-
10971094
switch (IntrID) {
10981095
default:
1096+
// XXX - Should this be volatile without known ordering?
1097+
Info.flags |= MachineMemOperand::MOVolatile;
10991098
break;
11001099
case Intrinsic::amdgcn_raw_buffer_load_lds:
11011100
case Intrinsic::amdgcn_raw_ptr_buffer_load_lds:
11021101
case Intrinsic::amdgcn_struct_buffer_load_lds:
11031102
case Intrinsic::amdgcn_struct_ptr_buffer_load_lds: {
11041103
unsigned Width = cast<ConstantInt>(CI.getArgOperand(2))->getZExtValue();
11051104
Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
1105+
Info.ptrVal = CI.getArgOperand(1);
11061106
return true;
11071107
}
11081108
}
@@ -1231,8 +1231,8 @@ bool SITargetLowering::getTgtMemIntrinsic(IntrinsicInfo &Info,
12311231
Info.opc = ISD::INTRINSIC_VOID;
12321232
unsigned Width = cast<ConstantInt>(CI.getArgOperand(2))->getZExtValue();
12331233
Info.memVT = EVT::getIntegerVT(CI.getContext(), Width * 8);
1234-
Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore |
1235-
MachineMemOperand::MOVolatile;
1234+
Info.ptrVal = CI.getArgOperand(1);
1235+
Info.flags |= MachineMemOperand::MOLoad | MachineMemOperand::MOStore;
12361236
return true;
12371237
}
12381238
case Intrinsic::amdgcn_ds_bvh_stack_rtn: {
@@ -8710,7 +8710,9 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
87108710
MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
87118711

87128712
MachinePointerInfo StorePtrI = LoadPtrI;
8713-
StorePtrI.V = nullptr;
8713+
LoadPtrI.V = PoisonValue::get(
8714+
PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
8715+
LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
87148716
StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
87158717

87168718
auto F = LoadMMO->getFlags() &
@@ -8788,6 +8790,8 @@ SDValue SITargetLowering::LowerINTRINSIC_VOID(SDValue Op,
87888790
MachinePointerInfo LoadPtrI = LoadMMO->getPointerInfo();
87898791
LoadPtrI.Offset = Op->getConstantOperandVal(5);
87908792
MachinePointerInfo StorePtrI = LoadPtrI;
8793+
LoadPtrI.V = PoisonValue::get(
8794+
PointerType::get(*DAG.getContext(), AMDGPUAS::GLOBAL_ADDRESS));
87918795
LoadPtrI.AddrSpace = AMDGPUAS::GLOBAL_ADDRESS;
87928796
StorePtrI.AddrSpace = AMDGPUAS::LOCAL_ADDRESS;
87938797
auto F = LoadMMO->getFlags() &

0 commit comments

Comments
 (0)