Reduce worst time complexity of mem parallelisation from O(2**n) to O(n**2).
authorChristoph Mallon <christoph.mallon@gmx.de>
Wed, 30 Jul 2008 09:55:44 +0000 (09:55 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Wed, 30 Jul 2008 09:55:44 +0000 (09:55 +0000)
[r20791]

ir/opt/ldst2.c

index abe2005..deed71c 100644 (file)
@@ -628,6 +628,10 @@ typedef struct parallelise_info
 
 static void parallelise_load(parallelise_info *pi, ir_node *irn)
 {
+       /* There is no point in investigating the same subgraph twice */
+       if (ir_nodeset_contains(&pi->user_mem, irn))
+               return;
+
        //ir_fprintf(stderr, "considering %+F\n", irn);
        if (get_nodes_block(irn) == pi->origin_block) {
                if (is_Proj(irn)) {
@@ -673,6 +677,10 @@ static void parallelise_load(parallelise_info *pi, ir_node *irn)
 
 static void parallelise_store(parallelise_info *pi, ir_node *irn)
 {
+       /* There is no point in investigating the same subgraph twice */
+       if (ir_nodeset_contains(&pi->user_mem, irn))
+               return;
+
        //ir_fprintf(stderr, "considering %+F\n", irn);
        if (get_nodes_block(irn) == pi->origin_block) {
                if (is_Proj(irn)) {