[PATCH] D159098: [NFC][AMDGPU] Small cleanup to R600 CF Finalizer
Luke Drummond via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 30 03:17:34 PDT 2023
ldrumm updated this revision to Diff 554656.
ldrumm added a comment.
Use `Register` instead of `optional<unsigned>
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159098/new/
https://reviews.llvm.org/D159098
Files:
llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp
Index: llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp
+++ llvm/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp
@@ -265,11 +265,8 @@
bool isCompatibleWithClause(const MachineInstr &MI,
std::set<unsigned> &DstRegs) const {
- unsigned DstMI, SrcMI;
- for (MachineInstr::const_mop_iterator I = MI.operands_begin(),
- E = MI.operands_end();
- I != E; ++I) {
- const MachineOperand &MO = *I;
+ Register DstMI, SrcMI;
+ for (const MachineOperand &MO : MI.operands()) {
if (!MO.isReg())
continue;
if (MO.isDef()) {
@@ -280,8 +277,8 @@
DstMI = TRI->getMatchingSuperReg(Reg,
R600RegisterInfo::getSubRegFromChannel(TRI->getHWRegChan(Reg)),
&R600::R600_Reg128RegClass);
- }
- if (MO.isUse()) {
+ } else {
+ assert(MO.isUse());
Register Reg = MO.getReg();
if (R600::R600_Reg128RegClass.contains(Reg))
SrcMI = Reg;
@@ -291,11 +288,13 @@
&R600::R600_Reg128RegClass);
}
}
- if ((DstRegs.find(SrcMI) == DstRegs.end())) {
- DstRegs.insert(DstMI);
- return true;
- } else
+ assert(SrcMI.isValid() && DstMI.isValid());
+ // If we've already seen this def in the given register set, we can't
+ // use a clause instruction
+ if (DstRegs.find(SrcMI) != DstRegs.end())
return false;
+ DstRegs.insert(DstMI);
+ return true;
}
ClauseFile
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159098.554656.patch
Type: text/x-patch
Size: 1633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230830/2b60c646/attachment.bin>
More information about the llvm-commits
mailing list