1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

AMDGPU/SILoadStoreOptimizer: Simplify function

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

Subscribers: merge_guards_bot, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71044
This commit is contained in:
Tom Stellard 2019-12-12 05:55:14 -08:00
parent 38470d9745
commit c17f304125

View File

@ -2006,80 +2006,68 @@ SILoadStoreOptimizer::optimizeInstsWithSameBaseAddr(
for (auto I = MergeList.begin(); I != MergeList.end(); ++I) {
CombineInfo &CI = *I;
if (CI.InstClass == UNKNOWN)
continue;
if (!findMatchingInst(CI))
goto done;
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
switch (CI.InstClass) {
default:
llvm_unreachable("unknown InstClass");
break;
case DS_READ:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeRead2Pair(CI);
CI.setMI(NewMI, *TII, *STM);
}
break;
case DS_WRITE:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeWrite2Pair(CI);
CI.setMI(NewMI, *TII, *STM);
}
break;
case S_BUFFER_LOAD_IMM:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeSBufferLoadImmPair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 16;
}
break;
case BUFFER_LOAD:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeBufferLoadPair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
}
break;
case BUFFER_STORE:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeBufferStorePair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
}
break;
case MIMG:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeImagePair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
}
break;
case TBUFFER_LOAD:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeTBufferLoadPair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
}
break;
case TBUFFER_STORE:
if (findMatchingInst(CI)) {
Modified = true;
removeCombinedInst(MergeList, *CI.Paired);
MachineBasicBlock::iterator NewMI = mergeTBufferStorePair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
}
case DS_READ: {
MachineBasicBlock::iterator NewMI = mergeRead2Pair(CI);
CI.setMI(NewMI, *TII, *STM);
break;
}
case DS_WRITE: {
MachineBasicBlock::iterator NewMI = mergeWrite2Pair(CI);
CI.setMI(NewMI, *TII, *STM);
break;
}
case S_BUFFER_LOAD_IMM: {
MachineBasicBlock::iterator NewMI = mergeSBufferLoadImmPair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 16;
break;
}
case BUFFER_LOAD: {
MachineBasicBlock::iterator NewMI = mergeBufferLoadPair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
break;
}
case BUFFER_STORE: {
MachineBasicBlock::iterator NewMI = mergeBufferStorePair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
break;
}
case MIMG: {
MachineBasicBlock::iterator NewMI = mergeImagePair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
break;
}
case TBUFFER_LOAD: {
MachineBasicBlock::iterator NewMI = mergeTBufferLoadPair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
break;
}
case TBUFFER_STORE: {
MachineBasicBlock::iterator NewMI = mergeTBufferStorePair(CI);
CI.setMI(NewMI, *TII, *STM);
OptimizeListAgain |= (CI.Width0 + CI.Width1) < 4;
break;
}
}
done:
// Clear the InstsToMove after we have finished searching so we don't have
// stale values left over if we search for this CI again in another pass
// over the block.