diff --git a/llvm/lib/CodeGen/PostRAHazardRecognizer.cpp b/llvm/lib/CodeGen/PostRAHazardRecognizer.cpp --- a/llvm/lib/CodeGen/PostRAHazardRecognizer.cpp +++ b/llvm/lib/CodeGen/PostRAHazardRecognizer.cpp @@ -76,6 +76,7 @@ return false; // Loop over all of the basic blocks + bool Changed = false; 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. @@ -85,6 +86,8 @@ HazardRec->EmitNoops(NumPreNoops); TII->insertNoops(MBB, MachineBasicBlock::iterator(MI), NumPreNoops); NumNoops += NumPreNoops; + if (NumPreNoops) + Changed = true; HazardRec->EmitInstruction(&MI); if (HazardRec->atIssueLimit()) { @@ -92,5 +95,5 @@ } } } - return true; + return Changed; }