OSDN Git Service

[llvm-mca] Correctly handle zero-latency stores that consume pipeline resources.
[android-x86/external-llvm.git] / tools / llvm-mca / Scheduler.cpp
index ead3226..a42cbef 100644 (file)
@@ -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;