[llvm] r274311 - CodeGen: Use MachineInstr& in PostRAHazardRecognizer, NFC
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 30 17:50:29 PDT 2016
Author: dexonsmith
Date: Thu Jun 30 19:50:29 2016
New Revision: 274311
URL: http://llvm.org/viewvc/llvm-project?rev=274311&view=rev
Log:
CodeGen: Use MachineInstr& in PostRAHazardRecognizer, NFC
Convert a loop to a range-based for, using MachineInstr& instead of
MachineInstr* and removing an implicit conversion from iterator to
pointer.
Modified:
llvm/trunk/lib/CodeGen/PostRAHazardRecognizer.cpp
Modified: llvm/trunk/lib/CodeGen/PostRAHazardRecognizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PostRAHazardRecognizer.cpp?rev=274311&r1=274310&r2=274311&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PostRAHazardRecognizer.cpp (original)
+++ llvm/trunk/lib/CodeGen/PostRAHazardRecognizer.cpp Thu Jun 30 19:50:29 2016
@@ -79,18 +79,16 @@ bool PostRAHazardRecognizer::runOnMachin
for (auto &MBB : Fn) {
// We do not call HazardRec->reset() here to make sure we are handling noop
// hazards at the start of basic blocks.
- for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end();
- I != E; ++I) {
- MachineInstr *MI = I;
+ for (MachineInstr &MI : MBB) {
// If we need to emit noops prior to this instruction, then do so.
- unsigned NumPreNoops = HazardRec->PreEmitNoops(MI);
+ unsigned NumPreNoops = HazardRec->PreEmitNoops(&MI);
for (unsigned i = 0; i != NumPreNoops; ++i) {
HazardRec->EmitNoop();
- TII->insertNoop(MBB, I);
+ TII->insertNoop(MBB, MachineBasicBlock::iterator(MI));
++NumNoops;
}
- HazardRec->EmitInstruction(MI);
+ HazardRec->EmitInstruction(&MI);
if (HazardRec->atIssueLimit()) {
HazardRec->AdvanceCycle();
}
More information about the llvm-commits
mailing list