[llvm-commits] [llvm] r172877 - /llvm/trunk/lib/Analysis/TargetTransformInfo.cpp

Renato Golin renato.golin at linaro.org
Fri Jan 18 16:42:16 PST 2013


Author: rengolin
Date: Fri Jan 18 18:42:16 2013
New Revision: 172877

URL: http://llvm.org/viewvc/llvm-project?rev=172877&view=rev
Log:
Fix 80-col and early exit in cost model

Modified:
    llvm/trunk/lib/Analysis/TargetTransformInfo.cpp

Modified: llvm/trunk/lib/Analysis/TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/TargetTransformInfo.cpp?rev=172877&r1=172876&r2=172877&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/TargetTransformInfo.cpp Fri Jan 18 18:42:16 2013
@@ -289,7 +289,9 @@
 
 //======================================= COST TABLES ==
 
-CostTable::CostTable(const CostTableEntry *table, const size_t size, unsigned numTypes)
+CostTable::CostTable(const CostTableEntry *table,
+                     const size_t size,
+                     unsigned numTypes)
   : table(table), size(size), numTypes(numTypes) {
   assert(table && "missing cost table");
   assert(size > 0 && "empty cost table");
@@ -297,22 +299,23 @@
 
 unsigned CostTable::_findCost(int ISD, MVT *Types) const {
   for (unsigned i = 0; i < size; ++i) {
-    if (table[i].ISD == ISD) {
-      bool found = true;
-      for (unsigned t=0; t<numTypes; t++) {
-        if (table[i].Types[t] != Types[t]) {
-          found = false;
-          break;
-        }
+    if (table[i].ISD != ISD)
+      continue;
+    bool found = true;
+    for (unsigned t=0; t<numTypes; t++) {
+      if (table[i].Types[t] != Types[t]) {
+        found = false;
+        break;
       }
-      if (found)
-        return table[i].Cost;
     }
+    if (found)
+      return table[i].Cost;
   }
   return COST_NOT_FOUND;
 }
 
-UnaryCostTable::UnaryCostTable(const CostTableEntry *table, const size_t size)
+UnaryCostTable::UnaryCostTable(const CostTableEntry *table,
+                               const size_t size)
   : CostTable(table, size, 1) { }
 
 unsigned UnaryCostTable::findCost(int ISD, MVT Type) const {
@@ -320,7 +323,8 @@
   return _findCost(ISD, tys);
 }
 
-BinaryCostTable::BinaryCostTable(const CostTableEntry *table, const size_t size)
+BinaryCostTable::BinaryCostTable(const CostTableEntry *table,
+                                 const size_t size)
   : CostTable(table, size, 2) { }
 
 unsigned BinaryCostTable::findCost(int ISD, MVT Type, MVT SrcType) const {





More information about the llvm-commits mailing list