Skip to content

Commit

Permalink
[NFC] Replace loop by idiomatic llvm::find_if
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-sans-paille committed Mar 16, 2021
1 parent 128ce70 commit 35368bb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1357,21 +1357,19 @@ void
TwoAddressInstructionPass::processTiedPairs(MachineInstr *MI,
TiedPairList &TiedPairs,
unsigned &Dist) {
bool IsEarlyClobber = false;
for (unsigned tpi = 0, tpe = TiedPairs.size(); tpi != tpe; ++tpi) {
const MachineOperand &DstMO = MI->getOperand(TiedPairs[tpi].second);
IsEarlyClobber |= DstMO.isEarlyClobber();
}
bool IsEarlyClobber = llvm::find_if(TiedPairs, [MI](auto const &TP) {
return MI->getOperand(TP.second).isEarlyClobber();
}) != TiedPairs.end();

bool RemovedKillFlag = false;
bool AllUsesCopied = true;
unsigned LastCopiedReg = 0;
SlotIndex LastCopyIdx;
Register RegB = 0;
unsigned SubRegB = 0;
for (unsigned tpi = 0, tpe = TiedPairs.size(); tpi != tpe; ++tpi) {
unsigned SrcIdx = TiedPairs[tpi].first;
unsigned DstIdx = TiedPairs[tpi].second;
for (auto &TP : TiedPairs) {
unsigned SrcIdx = TP.first;
unsigned DstIdx = TP.second;

const MachineOperand &DstMO = MI->getOperand(DstIdx);
Register RegA = DstMO.getReg();
Expand Down

0 comments on commit 35368bb

Please sign in to comment.