[llvm-mca] Correctly set the ReadAdvance information for register use operands.
The tool was passing the wrong operand index to method
MCSubtargetInfo::getReadAdvanceCycles(). That method requires a "UseIdx", and
not the operand index. This was found when testing X86 code where instructions
had a memory folded operand.
This patch fixes the issue and adds test read-advance-1.s to ensure that
the ReadAfterLd (a ReadAdvance of 3cy) information is correctly used.
llvm-svn: 328790
diff --git a/llvm/tools/llvm-mca/Scheduler.h b/llvm/tools/llvm-mca/Scheduler.h
index c690ad2..ad73fc7 100644
--- a/llvm/tools/llvm-mca/Scheduler.h
+++ b/llvm/tools/llvm-mca/Scheduler.h
@@ -430,9 +430,14 @@
// Notify the Backend that buffered resources were freed.
void notifyReleasedBuffers(llvm::ArrayRef<uint64_t> Buffers);
- /// Issue instructions from the ready queue by giving priority to older
- /// instructions.
- void issue();
+ /// Issue instructions from the ReadyQueue by giving priority to older
+ /// instructions. This method returns true if at least one instruction has
+ /// been promoted in the process from the WaitQueue to the ReadyQueue.
+ bool issue();
+
+ /// Scans the WaitQueue in search of instructions that can be moved to
+ /// the ReadyQueue.
+ bool promoteToReadyQueue();
/// Issue an instruction without updating the ready queue.
void issueInstruction(Instruction &IS, unsigned InstrIndex);