summaryrefslogtreecommitdiffhomepage
path: root/ir/kaps
diff options
context:
space:
mode:
authorAndreas Zwinkau <zwinkau@kit.edu>2011-04-08 16:21:07 +0200
committerAndreas Zwinkau <zwinkau@kit.edu>2011-04-08 16:26:20 +0200
commit171a98cff2d5ae80ee5a4f4cf71ba2a0e75e611e (patch)
tree636fe89eeace63686214f4d0c6b9f8ddb5ed4bb6 /ir/kaps
parentf60a80883e4fd60ce01af229990dc6907b4b8354 (diff)
Remove superfluous asserts
Diffstat (limited to 'ir/kaps')
-rw-r--r--ir/kaps/brute_force.c5
-rw-r--r--ir/kaps/bucket.c7
-rw-r--r--ir/kaps/heuristical.c1
-rw-r--r--ir/kaps/heuristical_co.c2
-rw-r--r--ir/kaps/heuristical_co_ld.c13
-rw-r--r--ir/kaps/html_dumper.c25
-rw-r--r--ir/kaps/kaps.c3
-rw-r--r--ir/kaps/matrix.c31
-rw-r--r--ir/kaps/optimal.c81
-rw-r--r--ir/kaps/pbqp_edge.c9
-rw-r--r--ir/kaps/pbqp_node.c6
-rw-r--r--ir/kaps/vector.c13
12 files changed, 5 insertions, 191 deletions
diff --git a/ir/kaps/brute_force.c b/ir/kaps/brute_force.c
index 94111ce..f32d2ed 100644
--- a/ir/kaps/brute_force.c
+++ b/ir/kaps/brute_force.c
@@ -77,7 +77,6 @@ static unsigned get_minimal_alternative(pbqp_t *pbqp, pbqp_node_t *node)
unsigned bucket_index;
assert(pbqp);
- assert(node);
node_vec = node->costs;
node_len = node_vec->len;
bucket_index = node->bucket_index;
@@ -151,7 +150,6 @@ static void apply_Brute_Force(pbqp_t *pbqp)
/* We want to reduce a node with maximum degree. */
node = get_node_with_max_degree();
- assert(node);
assert(pbqp_node_get_degree(node) > 2);
#if KAPS_DUMP
@@ -202,7 +200,6 @@ static void back_propagate_RI(pbqp_t *pbqp, pbqp_node_t *node)
int is_src;
assert(pbqp);
- assert(node);
edge = node->edges[0];
mat = edge->costs;
@@ -211,7 +208,6 @@ static void back_propagate_RI(pbqp_t *pbqp, pbqp_node_t *node)
if (is_src) {
other = edge->tgt;
- assert(other);
/* Update pointer for brute force solver. */
other = pbqp->nodes[other->index];
@@ -219,7 +215,6 @@ static void back_propagate_RI(pbqp_t *pbqp, pbqp_node_t *node)
node->solution = pbqp_matrix_get_col_min_index(mat, other->solution, vec);
} else {
other = edge->src;
- assert(other);
/* Update pointer for brute force solver. */
other = pbqp->nodes[other->index];
diff --git a/ir/kaps/bucket.c b/ir/kaps/bucket.c
index 77e8599..df7b65f 100644
--- a/ir/kaps/bucket.c
+++ b/ir/kaps/bucket.c
@@ -35,8 +35,6 @@
int edge_bucket_contains(pbqp_edge_bucket_t bucket, pbqp_edge_t *edge)
{
- assert(edge);
-
return edge->bucket_index < edge_bucket_get_length(bucket)
&& bucket[edge->bucket_index] == edge;
}
@@ -85,8 +83,6 @@ void node_bucket_shrink(pbqp_node_bucket_t *bucket, unsigned len)
int node_bucket_contains(pbqp_node_bucket_t bucket, pbqp_node_t *node)
{
- assert(node);
-
return node->bucket_index < node_bucket_get_length(bucket)
&& bucket[node->bucket_index] == node;
}
@@ -141,7 +137,6 @@ pbqp_node_t *node_bucket_pop(pbqp_node_bucket_t *bucket)
assert(bucket_len > 0);
node = (*bucket)[bucket_len - 1];
- assert(node);
ARR_SHRINKLEN(*bucket, (int)bucket_len - 1);
node->bucket_index = UINT_MAX;
@@ -155,9 +150,7 @@ void node_bucket_remove(pbqp_node_bucket_t *bucket, pbqp_node_t *node)
unsigned node_index;
pbqp_node_t *other;
- assert(node);
assert(node_bucket_contains(*bucket, node));
- assert(bucket_len > 0);
node_index = node->bucket_index;
other = (*bucket)[bucket_len - 1];
diff --git a/ir/kaps/heuristical.c b/ir/kaps/heuristical.c
index c078f5d..7c2a294 100644
--- a/ir/kaps/heuristical.c
+++ b/ir/kaps/heuristical.c
@@ -55,7 +55,6 @@ static void apply_RN(pbqp_t *pbqp)
/* We want to reduce a node with maximum degree. */
node = get_node_with_max_degree();
- assert(node);
assert(pbqp_node_get_degree(node) > 2);
#if KAPS_DUMP
diff --git a/ir/kaps/heuristical_co.c b/ir/kaps/heuristical_co.c
index aa30729..bbd961b 100644
--- a/ir/kaps/heuristical_co.c
+++ b/ir/kaps/heuristical_co.c
@@ -63,7 +63,6 @@ static void merge_into_RN_node(pbqp_t *pbqp, plist_t *rpeo)
plist_insert_back(rpeo, node);
} while(node_is_reduced(node));
- assert(node);
assert(pbqp_node_get_degree(node) > 2);
/* Check whether we can merge a neighbor into the current node. */
@@ -79,7 +78,6 @@ static void apply_RN_co(pbqp_t *pbqp)
node = merged_node;
merged_node = NULL;
- assert(node);
if (node_is_reduced(node))
return;
diff --git a/ir/kaps/heuristical_co_ld.c b/ir/kaps/heuristical_co_ld.c
index ba694f9..ff848cb 100644
--- a/ir/kaps/heuristical_co_ld.c
+++ b/ir/kaps/heuristical_co_ld.c
@@ -36,11 +36,6 @@ static void back_propagate_RI(pbqp_t *pbqp, pbqp_node_t *node)
vector_t *vec;
int is_src;
- assert(pbqp);
- assert(node);
-
- (void) pbqp;
-
edge = node->edges[0];
mat = edge->costs;
is_src = edge->src == node;
@@ -48,13 +43,9 @@ static void back_propagate_RI(pbqp_t *pbqp, pbqp_node_t *node)
if (is_src) {
other = edge->tgt;
- assert(other);
-
node->solution = pbqp_matrix_get_col_min_index(mat, other->solution, vec);
} else {
other = edge->src;
- assert(other);
-
node->solution = pbqp_matrix_get_row_min_index(mat, other->solution, vec);
}
@@ -225,7 +216,6 @@ static void merge_into_RN_node(pbqp_t *pbqp, plist_t *rpeo)
plist_insert_front(rpeo, node);
} while(node_is_reduced(node));
- assert(node);
assert(pbqp_node_get_degree(node) > 2);
/* Check whether we can merge a neighbor into the current node. */
@@ -241,7 +231,6 @@ static void apply_RN_co_without_selection(pbqp_t *pbqp)
node = merged_node;
merged_node = NULL;
- assert(node);
if (node_is_reduced(node))
return;
@@ -262,10 +251,8 @@ static void apply_RN_co_without_selection(pbqp_t *pbqp)
/* get neighbor node */
edge = node->edges[edge_index];
- assert(edge);
neighbor = edge->src == node ? edge->tgt : edge->src;
- assert(neighbor);
assert(neighbor != node);
diff --git a/ir/kaps/html_dumper.c b/ir/kaps/html_dumper.c
index 93d0fd1..f29a88d 100644
--- a/ir/kaps/html_dumper.c
+++ b/ir/kaps/html_dumper.c
@@ -53,7 +53,6 @@ static const char *cost2a(num const cost)
static void dump_vector(FILE *f, vector_t *vec)
{
unsigned index;
- assert(vec);
fprintf(f, "<span class=\"vector\">( ");
unsigned len = vec->len;
@@ -72,11 +71,10 @@ static void dump_vector(FILE *f, vector_t *vec)
static void dump_matrix(FILE *f, pbqp_matrix_t *mat)
{
unsigned row, col;
- assert(mat);
num *p = mat->entries;
- assert(mat->cols> 0);
- assert(mat->rows> 0);
+ assert(mat->cols > 0);
+ assert(mat->rows > 0);
fprintf(f, "\t\\begin{pmatrix}\n");
for (row = 0; row < mat->rows; ++row) {
fprintf(f, "\t %s", cost2a(*p++));
@@ -102,9 +100,6 @@ static void dump_edge_costs(pbqp_t *pbqp)
{
unsigned src_index;
- assert(pbqp);
- assert(pbqp->dump_file);
-
fputs("<p>", pbqp->dump_file);
for (src_index = 0; src_index < pbqp->num_nodes; ++src_index) {
pbqp_node_t *src_node = get_node(pbqp, src_index);
@@ -127,8 +122,6 @@ static void dump_edge_costs(pbqp_t *pbqp)
void dump_node(FILE *file, pbqp_node_t *node)
{
- assert(file);
-
if (node) {
fprintf(file, "\tc<sub>%d</sub> = ", node->index);
dump_vector(file, node->costs);
@@ -140,9 +133,6 @@ static void dump_node_costs(pbqp_t *pbqp)
{
unsigned index;
- assert(pbqp);
- assert(pbqp->dump_file);
-
/* dump node costs */
fputs("<p>", pbqp->dump_file);
for (index = 0; index < pbqp->num_nodes; ++index) {
@@ -153,8 +143,6 @@ static void dump_node_costs(pbqp_t *pbqp)
void dump_section(FILE *f, int level, const char *txt)
{
- assert(f);
-
fprintf(f, "<h%d>%s</h%d>\n", level, txt, level);
}
@@ -162,9 +150,6 @@ void pbqp_dump_graph(pbqp_t *pbqp)
{
unsigned src_index;
- assert(pbqp);
- assert(pbqp->dump_file);
-
fputs("<p>\n<graph>\n\tgraph input {\n", pbqp->dump_file);
for (src_index = 0; src_index < pbqp->num_nodes; ++src_index) {
pbqp_node_t *node = get_node(pbqp, src_index);
@@ -202,9 +187,6 @@ void pbqp_dump_graph(pbqp_t *pbqp)
void pbqp_dump_input(pbqp_t *pbqp)
{
- assert(pbqp);
- assert(pbqp->dump_file);
-
dump_section(pbqp->dump_file, 1, "1. PBQP Problem");
dump_section(pbqp->dump_file, 2, "1.1 Topology");
pbqp_dump_graph(pbqp);
@@ -216,9 +198,6 @@ void pbqp_dump_input(pbqp_t *pbqp)
void dump_simplifyedge(pbqp_t *pbqp, pbqp_edge_t *edge)
{
- assert(pbqp);
- assert(pbqp->dump_file);
-
dump_node(pbqp->dump_file, edge->src);
dump_edge(pbqp->dump_file, edge);
dump_node(pbqp->dump_file, edge->tgt);
diff --git a/ir/kaps/kaps.c b/ir/kaps/kaps.c
index 8bbbd93..78b4c0d 100644
--- a/ir/kaps/kaps.c
+++ b/ir/kaps/kaps.c
@@ -55,7 +55,6 @@ pbqp_edge_t *get_edge(pbqp_t *pbqp, unsigned src_index, unsigned tgt_index)
pbqp_node_t *src_node = get_node(pbqp, src_index);
pbqp_node_t *tgt_node = get_node(pbqp, tgt_index);
- assert(src_node);
assert(tgt_node);
len = ARR_LEN(src_node->edges);
@@ -134,7 +133,6 @@ void add_edge_costs(pbqp_t *pbqp, unsigned src_index, unsigned tgt_index,
num get_node_solution(pbqp_t *pbqp, unsigned node_index)
{
pbqp_node_t *node = get_node(pbqp, node_index);
- assert(node);
return node->solution;
}
@@ -147,7 +145,6 @@ num get_solution(pbqp_t *pbqp)
#if KAPS_DUMP
void set_dumpfile(pbqp *pbqp, FILE *f)
{
- assert(pbqp);
pbqp->dump_file = f;
}
#endif
diff --git a/ir/kaps/matrix.c b/ir/kaps/matrix.c
index 8608057..47c1546 100644
--- a/ir/kaps/matrix.c
+++ b/ir/kaps/matrix.c
@@ -35,13 +35,12 @@
pbqp_matrix_t *pbqp_matrix_alloc(pbqp_t *pbqp, unsigned rows, unsigned cols)
{
- assert(cols> 0);
- assert(rows> 0);
+ assert(cols > 0);
+ assert(rows > 0);
unsigned length = rows * cols;
pbqp_matrix_t *mat = (pbqp_matrix_t*)obstack_alloc(&pbqp->obstack, sizeof(*mat) + sizeof(*mat->entries) * length);
- assert(mat);
mat->cols = cols;
mat->rows = rows;
@@ -67,7 +66,6 @@ pbqp_matrix_t *pbqp_matrix_copy_and_transpose(pbqp_t *pbqp, pbqp_matrix_t *m)
unsigned rows = m->rows;
unsigned len = rows * cols;
pbqp_matrix_t *copy = (pbqp_matrix_t*)obstack_alloc(&pbqp->obstack, sizeof(*copy) + sizeof(*copy->entries) * len);
- assert(copy);
for (i = 0; i < rows; ++i) {
for (j = 0; j < cols; ++j) {
@@ -85,7 +83,6 @@ void pbqp_matrix_transpose(pbqp_t *pbqp, pbqp_matrix_t *mat)
{
unsigned len;
- assert(mat);
len = mat->rows * mat->cols;
pbqp_matrix_t *tmp = pbqp_matrix_copy_and_transpose(pbqp, mat);
@@ -100,8 +97,6 @@ void pbqp_matrix_add(pbqp_matrix_t *sum, pbqp_matrix_t *summand)
int i;
int len;
- assert(sum);
- assert(summand);
assert(sum->cols == summand->cols);
assert(sum->rows == summand->rows);
@@ -117,7 +112,6 @@ void pbqp_matrix_set_col_value(pbqp_matrix_t *mat, unsigned col, num value)
unsigned row_index;
unsigned row_len;
- assert(mat);
assert(col < mat->cols);
row_len = mat->rows;
@@ -132,7 +126,6 @@ void pbqp_matrix_set_row_value(pbqp_matrix_t *mat, unsigned row, num value)
unsigned col_index;
unsigned col_len;
- assert(mat);
assert(row < mat->rows);
col_len = mat->cols;
@@ -144,7 +137,6 @@ void pbqp_matrix_set_row_value(pbqp_matrix_t *mat, unsigned row, num value)
void pbqp_matrix_set(pbqp_matrix_t *mat, unsigned row, unsigned col, num value)
{
- assert(mat);
assert(col < mat->cols);
assert(row < mat->rows);
@@ -156,8 +148,6 @@ num pbqp_matrix_get_col_min(pbqp_matrix_t *matrix, unsigned col_index, vector_t
unsigned row_index;
num min = INF_COSTS;
- assert(matrix);
- assert(flags);
assert(matrix->rows == flags->len);
unsigned col_len = matrix->cols;
@@ -183,8 +173,6 @@ unsigned pbqp_matrix_get_col_min_index(pbqp_matrix_t *matrix, unsigned col_index
unsigned min_index = 0;
num min = INF_COSTS;
- assert(matrix);
- assert(flags);
assert(matrix->rows == flags->len);
unsigned col_len = matrix->cols;
@@ -212,8 +200,6 @@ void pbqp_matrix_sub_col_value(pbqp_matrix_t *matrix, unsigned col_index,
unsigned row_index;
unsigned row_len;
- assert(matrix);
- assert(flags);
assert(matrix->rows == flags->len);
col_len = matrix->cols;
@@ -237,8 +223,6 @@ num pbqp_matrix_get_row_min(pbqp_matrix_t *matrix, unsigned row_index, vector_t
unsigned col_index;
num min = INF_COSTS;
- assert(matrix);
- assert(flags);
assert(matrix->cols == flags->len);
unsigned len = flags->len;
@@ -263,8 +247,6 @@ unsigned pbqp_matrix_get_row_min_index(pbqp_matrix_t *matrix, unsigned row_index
unsigned min_index = 0;
num min = INF_COSTS;
- assert(matrix);
- assert(flags);
assert(matrix->cols == flags->len);
unsigned len = flags->len;
@@ -290,8 +272,6 @@ void pbqp_matrix_sub_row_value(pbqp_matrix_t *matrix, unsigned row_index,
unsigned col_index;
unsigned col_len;
- assert(matrix);
- assert(flags);
assert(matrix->cols == flags->len);
col_len = matrix->cols;
@@ -316,9 +296,6 @@ int pbqp_matrix_is_zero(pbqp_matrix_t *mat, vector_t *src_vec, vector_t *tgt_vec
unsigned row_index;
unsigned row_len;
- assert(mat);
- assert(src_vec);
- assert(tgt_vec);
assert(mat->cols = tgt_vec->len);
assert(mat->rows = src_vec->len);
@@ -346,8 +323,6 @@ void pbqp_matrix_add_to_all_cols(pbqp_matrix_t *mat, vector_t *vec)
unsigned row_index;
unsigned row_len;
- assert(mat);
- assert(vec);
assert(mat->rows == vec->len);
col_len = mat->cols;
@@ -369,8 +344,6 @@ void pbqp_matrix_add_to_all_rows(pbqp_matrix_t *mat, vector_t *vec)
unsigned row_index;
unsigned row_len;
- assert(mat);
- assert(vec);
assert(mat->cols == vec->len);
col_len = mat->cols;
diff --git a/ir/kaps/optimal.c b/ir/kaps/optimal.c
index fe82844..3dfdd2f 100644
--- a/ir/kaps/optimal.c
+++ b/ir/kaps/optimal.c
@@ -106,7 +106,6 @@ void fill_node_buckets(pbqp_t *pbqp)
unsigned node_index;
unsigned node_len;
- assert(pbqp);
node_len = pbqp->num_nodes;
#if KAPS_TIMING
@@ -150,17 +149,11 @@ static void normalize_towards_source(pbqp_edge_t *edge)
unsigned src_index;
unsigned new_infinity = 0;
- assert(edge);
-
src_node = edge->src;
tgt_node = edge->tgt;
- assert(src_node);
- assert(tgt_node);
src_vec = src_node->costs;
tgt_vec = tgt_node->costs;
- assert(src_vec);
- assert(tgt_vec);
src_len = src_vec->len;
tgt_len = tgt_vec->len;
@@ -168,7 +161,6 @@ static void normalize_towards_source(pbqp_edge_t *edge)
assert(tgt_len > 0);
mat = edge->costs;
- assert(mat);
/* Normalize towards source node. */
for (src_index = 0; src_index < src_len; ++src_index) {
@@ -216,17 +208,11 @@ static void normalize_towards_target(pbqp_edge_t *edge)
unsigned tgt_index;
unsigned new_infinity = 0;
- assert(edge);
-
src_node = edge->src;
tgt_node = edge->tgt;
- assert(src_node);
- assert(tgt_node);
src_vec = src_node->costs;
tgt_vec = tgt_node->costs;
- assert(src_vec);
- assert(tgt_vec);
src_len = src_vec->len;
tgt_len = tgt_vec->len;
@@ -234,7 +220,6 @@ static void normalize_towards_target(pbqp_edge_t *edge)
assert(tgt_len > 0);
mat = edge->costs;
- assert(mat);
/* Normalize towards target node. */
for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
@@ -291,18 +276,11 @@ static void merge_source_into_target(pbqp_t *pbqp, pbqp_edge_t *edge)
unsigned edge_index;
unsigned edge_len;
- assert(pbqp);
- assert(edge);
-
src_node = edge->src;
tgt_node = edge->tgt;
- assert(src_node);
- assert(tgt_node);
src_vec = src_node->costs;
tgt_vec = tgt_node->costs;
- assert(src_vec);
- assert(tgt_vec);
src_len = src_vec->len;
tgt_len = tgt_vec->len;
@@ -312,7 +290,6 @@ static void merge_source_into_target(pbqp_t *pbqp, pbqp_edge_t *edge)
assert(tgt_len > 1);
mat = edge->costs;
- assert(mat);
mapping = NEW_ARR_F(unsigned, tgt_len);
@@ -369,12 +346,10 @@ static void merge_source_into_target(pbqp_t *pbqp, pbqp_edge_t *edge)
unsigned tgt_index;
assert(old_edge);
-
if (old_edge == edge)
continue;
old_matrix = old_edge->costs;
- assert(old_matrix);
if (old_edge->tgt == src_node) {
other_node = old_edge->src;
@@ -384,7 +359,6 @@ static void merge_source_into_target(pbqp_t *pbqp, pbqp_edge_t *edge)
other_node = old_edge->tgt;
other_len = old_matrix->cols;
}
- assert(other_node);
other_vec = other_node->costs;
new_matrix = pbqp_matrix_alloc(pbqp, tgt_len, other_len);
@@ -465,18 +439,11 @@ static void merge_target_into_source(pbqp_t *pbqp, pbqp_edge_t *edge)
unsigned edge_index;
unsigned edge_len;
- assert(pbqp);
- assert(edge);
-
src_node = edge->src;
tgt_node = edge->tgt;
- assert(src_node);
- assert(tgt_node);
src_vec = src_node->costs;
tgt_vec = tgt_node->costs;
- assert(src_vec);
- assert(tgt_vec);
src_len = src_vec->len;
tgt_len = tgt_vec->len;
@@ -486,7 +453,6 @@ static void merge_target_into_source(pbqp_t *pbqp, pbqp_edge_t *edge)
assert(tgt_len > 1);
mat = edge->costs;
- assert(mat);
mapping = NEW_ARR_F(unsigned, src_len);
@@ -548,7 +514,6 @@ static void merge_target_into_source(pbqp_t *pbqp, pbqp_edge_t *edge)
continue;
old_matrix = old_edge->costs;
- assert(old_matrix);
if (old_edge->tgt == tgt_node) {
other_node = old_edge->src;
@@ -558,7 +523,6 @@ static void merge_target_into_source(pbqp_t *pbqp, pbqp_edge_t *edge)
other_node = old_edge->tgt;
other_len = old_matrix->cols;
}
- assert(other_node);
other_vec = other_node->costs;
new_matrix = pbqp_matrix_alloc(pbqp, src_len, other_len);
@@ -627,9 +591,6 @@ void apply_RM(pbqp_t *pbqp, pbqp_node_t *node)
unsigned edge_index;
unsigned edge_len;
- assert(node);
- assert(pbqp);
-
edges = node->edges;
edge_len = pbqp_node_get_degree(node);
@@ -643,7 +604,6 @@ void apply_RM(pbqp_t *pbqp, pbqp_node_t *node)
/* ALAP: Merge neighbors into given node. */
while(edge_bucket_get_length(rm_bucket) > 0) {
pbqp_edge_t *edge = edge_bucket_pop(&rm_bucket);
- assert(edge);
/* If the edge is not deleted: Try a merge. */
if (edge->src == node)
@@ -701,9 +661,6 @@ void simplify_edge(pbqp_t *pbqp, pbqp_edge_t *edge)
int src_len;
int tgt_len;
- assert(pbqp);
- assert(edge);
-
(void) pbqp;
src_node = edge->src;
@@ -725,8 +682,6 @@ void simplify_edge(pbqp_t *pbqp, pbqp_edge_t *edge)
src_vec = src_node->costs;
tgt_vec = tgt_node->costs;
- assert(src_vec);
- assert(tgt_vec);
src_len = src_vec->len;
tgt_len = tgt_vec->len;
@@ -734,7 +689,6 @@ void simplify_edge(pbqp_t *pbqp, pbqp_edge_t *edge)
assert(tgt_len > 0);
mat = edge->costs;
- assert(mat);
#if KAPS_DUMP
if (pbqp->dump_file) {
@@ -773,8 +727,6 @@ void initial_simplify_edges(pbqp_t *pbqp)
unsigned node_index;
unsigned node_len;
- assert(pbqp);
-
#if KAPS_TIMING
ir_timer_t *t_int_simpl = ir_timer_new();
ir_timer_start(t_int_simpl);
@@ -834,8 +786,6 @@ num determine_solution(pbqp_t *pbqp)
FILE *file;
#endif
- assert(pbqp);
-
(void) pbqp;
#if KAPS_DUMP
@@ -856,7 +806,6 @@ num determine_solution(pbqp_t *pbqp)
for (node_index = 0; node_index < node_len; ++node_index) {
pbqp_node_t *node = node_buckets[0][node_index];
- assert(node);
node->solution = vector_get_min_index(node->costs);
solution = pbqp_add(solution,
@@ -896,10 +845,6 @@ static void back_propagate_RI(pbqp_t *pbqp, pbqp_node_t *node)
pbqp_matrix_t *mat;
vector_t *vec;
int is_src;
-
- assert(pbqp);
- assert(node);
-
(void) pbqp;
edge = node->edges[0];
@@ -909,13 +854,9 @@ static void back_propagate_RI(pbqp_t *pbqp, pbqp_node_t *node)
if (is_src) {
other = edge->tgt;
- assert(other);
-
node->solution = pbqp_matrix_get_col_min_index(mat, other->solution, vec);
} else {
other = edge->src;
- assert(other);
-
node->solution = pbqp_matrix_get_row_min_index(mat, other->solution, vec);
}
@@ -941,8 +882,6 @@ static void back_propagate_RII(pbqp_t *pbqp, pbqp_node_t *node)
unsigned col_index;
unsigned row_index;
- assert(pbqp);
-
if (src_is_src) {
src_node = src_edge->tgt;
} else {
@@ -1010,8 +949,6 @@ void back_propagate(pbqp_t *pbqp)
unsigned node_index;
unsigned node_len = node_bucket_get_length(reduced_bucket);
- assert(pbqp);
-
#if KAPS_DUMP
if (pbqp->dump_file) {
dump_section(pbqp->dump_file, 2, "Back Propagation");
@@ -1050,7 +987,7 @@ void apply_RI(pbqp_t *pbqp)
int is_src = edge->src == node;
pbqp_node_t *other_node;
- (void ) pbqp;
+ (void) pbqp;
assert(pbqp_node_get_degree(node) == 1);
if (is_src) {
@@ -1120,7 +1057,6 @@ void apply_RII(pbqp_t *pbqp)
unsigned row_len;
unsigned node_len;
- assert(pbqp);
assert(pbqp_node_get_degree(node) == 2);
if (src_is_src) {
@@ -1251,17 +1187,11 @@ static void select_column(pbqp_edge_t *edge, unsigned col_index)
unsigned src_index;
unsigned new_infinity = 0;
- assert(edge);
-
src_node = edge->src;
tgt_node = edge->tgt;
- assert(src_node);
- assert(tgt_node);
src_vec = src_node->costs;
tgt_vec = tgt_node->costs;
- assert(src_vec);
- assert(tgt_vec);
src_len = src_vec->len;
tgt_len = tgt_vec->len;
@@ -1269,7 +1199,6 @@ static void select_column(pbqp_edge_t *edge, unsigned col_index)
assert(tgt_len > 0);
mat = edge->costs;
- assert(mat);
for (src_index = 0; src_index < src_len; ++src_index) {
num elem = mat->entries[src_index * tgt_len + col_index];
@@ -1309,20 +1238,15 @@ static void select_row(pbqp_edge_t *edge, unsigned row_index)
unsigned tgt_index;
unsigned new_infinity = 0;
- assert(edge);
-
src_node = edge->src;
tgt_node = edge->tgt;
- assert(tgt_node);
tgt_vec = tgt_node->costs;
- assert(tgt_vec);
tgt_len = tgt_vec->len;
assert(tgt_len > 0);
mat = edge->costs;
- assert(mat);
for (tgt_index = 0; tgt_index < tgt_len; ++tgt_index) {
num elem = mat->entries[row_index * tgt_len + tgt_index];
@@ -1360,7 +1284,6 @@ void select_alternative(pbqp_node_t *node, unsigned selected_index)
vector_t *node_vec;
unsigned max_degree = pbqp_node_get_degree(node);
- assert(node);
node->solution = selected_index;
node_vec = node->costs;
node_len = node_vec->len;
@@ -1419,8 +1342,6 @@ unsigned get_local_minimal_alternative(pbqp_t *pbqp, pbqp_node_t *node)
num min = INF_COSTS;
int is_src;
- assert(pbqp);
- assert(node);
node_vec = node->costs;
node_len = node_vec->len;
max_degree = pbqp_node_get_degree(node);
diff --git a/ir/kaps/pbqp_edge.c b/ir/kaps/pbqp_edge.c
index 8a1d0c4..1a90497 100644
--- a/ir/kaps/pbqp_edge.c
+++ b/ir/kaps/pbqp_edge.c
@@ -52,13 +52,10 @@ pbqp_edge_t *alloc_edge(pbqp_t *pbqp, int src_index, int tgt_index,
}
pbqp_edge_t *edge = OALLOC(&pbqp->obstack, pbqp_edge_t);
- assert(edge);
pbqp_node_t *src_node = get_node(pbqp, src_index);
- assert(src_node);
pbqp_node_t *tgt_node = get_node(pbqp, tgt_index);
- assert(tgt_node);
if (transpose) {
edge->costs = pbqp_matrix_copy_and_transpose(pbqp, costs);
@@ -84,12 +81,8 @@ void delete_edge(pbqp_edge_t *edge)
pbqp_node_t *src_node;
pbqp_node_t *tgt_node;
- assert(edge);
-
src_node = edge->src;
tgt_node = edge->tgt;
- assert(src_node);
- assert(tgt_node);
disconnect_edge(src_node, edge);
disconnect_edge(tgt_node, edge);
@@ -105,8 +98,6 @@ unsigned is_deleted(pbqp_edge_t *edge)
{
unsigned deleted;
- assert(edge);
-
deleted = (edge->src == NULL) && (edge-> tgt == NULL);
return deleted;
diff --git a/ir/kaps/pbqp_node.c b/ir/kaps/pbqp_node.c
index bb8a352..37cda95 100644
--- a/ir/kaps/pbqp_node.c
+++ b/ir/kaps/pbqp_node.c
@@ -40,7 +40,6 @@
pbqp_node_t *alloc_node(pbqp_t *pbqp, unsigned node_index, vector_t *costs)
{
pbqp_node_t *node = OALLOC(&pbqp->obstack, pbqp_node_t);
- assert(node);
node->edges = NEW_ARR_F(pbqp_edge_t *, 0);
node->costs = vector_copy(pbqp, costs);
@@ -58,8 +57,6 @@ int is_connected(pbqp_node_t *node, pbqp_edge_t *edge)
unsigned edge_len;
assert(node);
- assert(edge);
-
if (edge->src != node && edge->tgt != node) return 0;
edges = node->edges;
@@ -96,7 +93,6 @@ void disconnect_edge(pbqp_node_t *node, pbqp_edge_t *edge)
unsigned pbqp_node_get_degree(pbqp_node_t *node)
{
- assert(node);
return ARR_LEN(node->edges);
}
@@ -107,8 +103,6 @@ pbqp_node_t *pbqp_node_deep_copy(pbqp_t *pbqp, pbqp_node_bucket_t new_bucket,
unsigned edge_length = pbqp_node_get_degree(node);
pbqp_node_t *copy = OALLOC(&pbqp->obstack, pbqp_node_t);
- assert(copy);
-
copy->edges = NEW_ARR_F(pbqp_edge_t *, 0);
for (edge_index = 0; edge_index < edge_length; ++edge_index) {
pbqp_edge_t *edge_copy = NULL;
diff --git a/ir/kaps/vector.c b/ir/kaps/vector.c
index 04d58e6..4970d08 100644
--- a/ir/kaps/vector.c
+++ b/ir/kaps/vector.c
@@ -58,7 +58,6 @@ vector_t *vector_alloc(pbqp_t *pbqp, unsigned length)
{
assert(length > 0);
vector_t *vec = (vector_t*)obstack_alloc(&pbqp->obstack, sizeof(*vec) + sizeof(*vec->entries) * length);
- assert(vec);
vec->len = length;
memset(vec->entries, 0, sizeof(*vec->entries) * length);
@@ -80,8 +79,6 @@ void vector_add(vector_t *sum, vector_t *summand)
int i;
int len;
- assert(sum);
- assert(summand);
assert(sum->len == summand->len);
len = sum->len;
@@ -111,8 +108,6 @@ void vector_add_value(vector_t *vec, num value)
unsigned index;
unsigned len;
- assert(vec);
-
len = vec->len;
for (index = 0; index < len; ++index) {
@@ -125,8 +120,6 @@ void vector_add_matrix_col(vector_t *vec, pbqp_matrix_t *mat, unsigned col_index
unsigned index;
unsigned len;
- assert(vec);
- assert(mat);
assert(vec->len == mat->rows);
assert(col_index < mat->cols);
@@ -142,8 +135,6 @@ void vector_add_matrix_row(vector_t *vec, pbqp_matrix_t *mat, unsigned row_index
unsigned index;
unsigned len;
- assert(vec);
- assert(mat);
assert(vec->len == mat->cols);
assert(row_index < mat->rows);
@@ -161,8 +152,6 @@ num vector_get_min(vector_t *vec)
unsigned len;
num min = INF_COSTS;
- assert(vec);
-
len = vec->len;
assert(len > 0);
@@ -184,8 +173,6 @@ unsigned vector_get_min_index(vector_t *vec)
unsigned min_index = 0;
num min = INF_COSTS;
- assert(vec);
-
len = vec->len;
assert(len > 0);