[llvm] r315068 - [TableGen] Simplify SubtargetEmitter

Javed Absar via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 08:25:04 PDT 2017


Author: javed.absar
Date: Fri Oct  6 08:25:04 2017
New Revision: 315068

URL: http://llvm.org/viewvc/llvm-project?rev=315068&view=rev
Log:
[TableGen] Simplify SubtargetEmitter

Remove unnecessary duplicate if-condition.


Modified:
    llvm/trunk/utils/TableGen/SubtargetEmitter.cpp

Modified: llvm/trunk/utils/TableGen/SubtargetEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/SubtargetEmitter.cpp?rev=315068&r1=315067&r2=315068&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/SubtargetEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/SubtargetEmitter.cpp Fri Oct  6 08:25:04 2017
@@ -821,14 +821,10 @@ void SubtargetEmitter::GenSchedClassTabl
 
     // A Variant SchedClass has no resources of its own.
     bool HasVariants = false;
-    for (std::vector<CodeGenSchedTransition>::const_iterator
-           TI = SC.Transitions.begin(), TE = SC.Transitions.end();
-         TI != TE; ++TI) {
-      if (TI->ProcIndices[0] == 0) {
-        HasVariants = true;
-        break;
-      }
-      if (is_contained(TI->ProcIndices, ProcModel.Index)) {
+    for (const CodeGenSchedTransition &CGT :
+           make_range(SC.Transitions.begin(), SC.Transitions.end())) {
+      if (CGT.ProcIndices[0] == 0 ||
+          is_contained(CGT.ProcIndices, ProcModel.Index)) {
         HasVariants = true;
         break;
       }




More information about the llvm-commits mailing list