diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-04-30 15:55:04 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-04-30 15:55:04 +0000 |
commit | e047d3529baa0920dc55ae278c39e40f03baa2af (patch) | |
tree | 810cfa6949204c8677c6d4e971f09791bf60f36a /llvm/tools | |
parent | 79e5cd2fc50f810f9ebfef41422695773caaffa7 (diff) | |
download | bcm5719-llvm-e047d3529baa0920dc55ae278c39e40f03baa2af.tar.gz bcm5719-llvm-e047d3529baa0920dc55ae278c39e40f03baa2af.zip |
[llvm-mca] Correctly handle zero-latency stores that consume pipeline resources.
This fixes PR37293.
We can have scheduling classes with no write latency entries, that still consume
processor resources. We don't want to treat those instructions as zero-latency
instructions; they still have to be issued to the underlying pipelines, so they
still consume resource cycles.
This is likely to be a regression which I have accidentally introduced at
revision 330807. Now, if an instruction has a non-empty set of write processor
resources, we conservatively treat it as a normal (i.e. non zero-latency)
instruction.
llvm-svn: 331193
Diffstat (limited to 'llvm/tools')
-rw-r--r-- | llvm/tools/llvm-mca/Dispatch.cpp | 3 | ||||
-rw-r--r-- | llvm/tools/llvm-mca/Scheduler.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/llvm/tools/llvm-mca/Dispatch.cpp b/llvm/tools/llvm-mca/Dispatch.cpp index 47f8dca2179..9bccca7dd36 100644 --- a/llvm/tools/llvm-mca/Dispatch.cpp +++ b/llvm/tools/llvm-mca/Dispatch.cpp @@ -411,7 +411,8 @@ void DispatchUnit::dispatch(unsigned IID, Instruction *NewInst, // instruction. The assumption is that a zero-latency instruction doesn't // require to be issued to the scheduler for execution. More importantly, it // doesn't have to wait on the register input operands. - if (NewInst->getDesc().MaxLatency) + const InstrDesc &Desc = NewInst->getDesc(); + if (Desc.MaxLatency || !Desc.Resources.empty()) for (std::unique_ptr<ReadState> &RS : NewInst->getUses()) updateRAWDependencies(*RS, STI); diff --git a/llvm/tools/llvm-mca/Scheduler.cpp b/llvm/tools/llvm-mca/Scheduler.cpp index ead32260ec5..a42cbef2eff 100644 --- a/llvm/tools/llvm-mca/Scheduler.cpp +++ b/llvm/tools/llvm-mca/Scheduler.cpp @@ -258,12 +258,13 @@ void Scheduler::scheduleInstruction(unsigned Idx, Instruction &MCIS) { // targets, zero-idiom instructions (for example: a xor that clears the value // of a register) are treated speacially, and are often eliminated at register // renaming stage. + bool IsZeroLatency = !Desc.MaxLatency && Desc.Resources.empty(); // Instructions that use an in-order dispatch/issue processor resource must be // issued immediately to the pipeline(s). Any other in-order buffered // resources (i.e. BufferSize=1) is consumed. - if (Desc.MaxLatency && !Resources->mustIssueImmediately(Desc)) { + if (!IsZeroLatency && !Resources->mustIssueImmediately(Desc)) { DEBUG(dbgs() << "[SCHEDULER] Adding " << Idx << " to the Ready Queue\n"); ReadyQueue[Idx] = &MCIS; return; |