[llvm] r327231 - [TargetSchedule] Minor refactor in computeInstrLatency. NFC

Andrea Di Biagio via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 10 16:51:33 PST 2018


Author: adibiagio
Date: Sat Mar 10 16:51:33 2018
New Revision: 327231

URL: http://llvm.org/viewvc/llvm-project?rev=327231&view=rev
Log:
[TargetSchedule] Minor refactor in computeInstrLatency. NFC

The intent of revision r300311 was to add a check for invalid scheduling class
descriptors. However, it ended up adding a redundant call in a basic block that
should not be reachable.

Modified:
    llvm/trunk/lib/CodeGen/TargetSchedule.cpp

Modified: llvm/trunk/lib/CodeGen/TargetSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetSchedule.cpp?rev=327231&r1=327230&r2=327231&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetSchedule.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetSchedule.cpp Sat Mar 10 16:51:33 2018
@@ -274,14 +274,12 @@ unsigned TargetSchedModel::computeInstrL
   unsigned SCIdx = TII->get(Opcode).getSchedClass();
   const MCSchedClassDesc *SCDesc = SchedModel.getSchedClassDesc(SCIdx);
 
-  if (SCDesc->isValid() && !SCDesc->isVariant())
+  if (!SCDesc->isValid())
+    return 0;
+  if (!SCDesc->isVariant())
     return computeInstrLatency(*SCDesc);
 
-  if (SCDesc->isValid()) {
-    assert (!SCDesc->isVariant() && "No MI sched latency: SCDesc->isVariant()");
-    return computeInstrLatency(*SCDesc);
-  }
-  return 0;
+  llvm_unreachable("No MI sched latency");
 }
 
 unsigned




More information about the llvm-commits mailing list