[PATCH] D152302: [AMDGPU] Replace std::pair with VOPDCombineInfo in VOPD combine. NFC.
Stanislav Mekhanoshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 6 12:54:27 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfebcf99e9d2c: [AMDGPU] Replace std::pair with VOPDCombineInfo in VOPD combine. NFC. (authored by rampitec).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152302/new/
https://reviews.llvm.org/D152302
Files:
llvm/lib/Target/AMDGPU/GCNCreateVOPD.cpp
Index: llvm/lib/Target/AMDGPU/GCNCreateVOPD.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/GCNCreateVOPD.cpp
+++ llvm/lib/Target/AMDGPU/GCNCreateVOPD.cpp
@@ -42,6 +42,16 @@
class GCNCreateVOPD : public MachineFunctionPass {
private:
+ class VOPDCombineInfo {
+ public:
+ VOPDCombineInfo() {}
+ VOPDCombineInfo(MachineInstr *First, MachineInstr *Second)
+ : FirstMI(First), SecondMI(Second) {}
+
+ MachineInstr *FirstMI;
+ MachineInstr *SecondMI;
+ };
+
public:
static char ID;
const GCNSubtarget *ST = nullptr;
@@ -57,10 +67,9 @@
return "GCN Create VOPD Instructions";
}
- bool doReplace(const SIInstrInfo *SII,
- std::pair<MachineInstr *, MachineInstr *> &Pair) {
- auto *FirstMI = Pair.first;
- auto *SecondMI = Pair.second;
+ bool doReplace(const SIInstrInfo *SII, VOPDCombineInfo &CI) {
+ auto *FirstMI = CI.FirstMI;
+ auto *SecondMI = CI.SecondMI;
unsigned Opc1 = FirstMI->getOpcode();
unsigned Opc2 = SecondMI->getOpcode();
int NewOpcode = AMDGPU::getVOPDFull(AMDGPU::getVOPDOpcode(Opc1),
@@ -94,7 +103,7 @@
VOPDInst.copyImplicitOps(*MI[CompIdx]);
LLVM_DEBUG(dbgs() << "VOPD Fused: " << *VOPDInst << " from\tX: "
- << *Pair.first << "\tY: " << *Pair.second << "\n");
+ << *CI.FirstMI << "\tY: " << *CI.SecondMI << "\n");
for (auto CompIdx : VOPD::COMPONENTS)
MI[CompIdx]->eraseFromParent();
@@ -114,7 +123,7 @@
const SIInstrInfo *SII = ST->getInstrInfo();
bool Changed = false;
- SmallVector<std::pair<MachineInstr *, MachineInstr *>> ReplaceCandidates;
+ SmallVector<VOPDCombineInfo> ReplaceCandidates;
for (auto &MBB : MF) {
auto MII = MBB.begin(), E = MBB.end();
@@ -130,24 +139,24 @@
unsigned Opc2 = SecondMI->getOpcode();
llvm::AMDGPU::CanBeVOPD FirstCanBeVOPD = AMDGPU::getCanBeVOPD(Opc);
llvm::AMDGPU::CanBeVOPD SecondCanBeVOPD = AMDGPU::getCanBeVOPD(Opc2);
- std::pair<MachineInstr *, MachineInstr *> Pair;
+ VOPDCombineInfo CI;
if (FirstCanBeVOPD.X && SecondCanBeVOPD.Y)
- Pair = {FirstMI, SecondMI};
+ CI = VOPDCombineInfo(FirstMI, SecondMI);
else if (FirstCanBeVOPD.Y && SecondCanBeVOPD.X)
- Pair = {SecondMI, FirstMI};
+ CI = VOPDCombineInfo(SecondMI, FirstMI);
else
continue;
// checkVOPDRegConstraints cares about program order, but doReplace
// cares about X-Y order in the constituted VOPD
if (llvm::checkVOPDRegConstraints(*SII, *FirstMI, *SecondMI)) {
- ReplaceCandidates.push_back(Pair);
+ ReplaceCandidates.push_back(CI);
++MII;
}
}
}
- for (auto &Pair : ReplaceCandidates) {
- Changed |= doReplace(SII, Pair);
+ for (auto &CI : ReplaceCandidates) {
+ Changed |= doReplace(SII, CI);
}
return Changed;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152302.528998.patch
Type: text/x-patch
Size: 3007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230606/55484036/attachment.bin>
More information about the llvm-commits
mailing list