summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2013-01-19 00:42:16 +0000
committerRenato Golin <renato.golin@linaro.org>2013-01-19 00:42:16 +0000
commit065db2347f4df7a92f18221bd7288ebcd4c38c35 (patch)
tree0160e493ce9513371e7e9e0c938e56fdf3fea9c7 /lib
parentd32eea963699c279f58b5338ab1b5b3bd713fd22 (diff)
downloadllvm-065db2347f4df7a92f18221bd7288ebcd4c38c35.tar.gz
llvm-065db2347f4df7a92f18221bd7288ebcd4c38c35.tar.bz2
llvm-065db2347f4df7a92f18221bd7288ebcd4c38c35.tar.xz
Fix 80-col and early exit in cost model
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/TargetTransformInfo.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/Analysis/TargetTransformInfo.cpp b/lib/Analysis/TargetTransformInfo.cpp
index 344be719cb..4873a7f923 100644
--- a/lib/Analysis/TargetTransformInfo.cpp
+++ b/lib/Analysis/TargetTransformInfo.cpp
@@ -289,7 +289,9 @@ ImmutablePass *llvm::createNoTargetTransformInfoPass() {
//======================================= 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 @@ CostTable::CostTable(const CostTableEntry *table, const size_t size, unsigned nu
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 @@ unsigned UnaryCostTable::findCost(int ISD, MVT Type) const {
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 {