[PR,57806] Wasted work in propagate_nothrow()
diff mbox

Message ID 156a7879bd3fb4dd2e5eace924a46df4.squirrel@webmail.cs.wisc.edu
State New
Headers show

Commit Message

pchang9@cs.wisc.edu July 19, 2013, 11:07 p.m. UTC
Hi,

The problem appears in revision 201034 in version 4.9.  I attached a
one-line patch that fixes it.  I also reported this problem
at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57806

I bootstrapped and ran the regression tests for this patch on x86_64-linux
and all tests pass.

In method "propagate_nothrow()" in gcc/ipa-pure-const.c, the loop on line
1432 should break immediately after "can_throw" is set to "true". All the
iterations after "can_throw" set to "true" do not perform any useful work,
at best they just set "can_throw" again to "true".



-Chang
Index: gcc/ipa-pure-const.c
===================================================================
--- gcc/ipa-pure-const.c	(revision 201034)
+++ gcc/ipa-pure-const.c	(working copy)
@@ -1431,7 +1431,10 @@
 	    }
           for (ie = node->indirect_calls; ie; ie = ie->next_callee)
 	    if (ie->can_throw_external)
-	      can_throw = true;
+	      {
+	        can_throw = true;
+		break;
+	      }
 	  w_info = (struct ipa_dfs_info *) w->symbol.aux;
 	  w = w_info->next_cycle;
 	}

Patch
diff mbox

Index: gcc/ipa-pure-const.c
===================================================================
--- gcc/ipa-pure-const.c	(revision 201034)
+++ gcc/ipa-pure-const.c	(working copy)
@@ -1431,7 +1431,10 @@ 
 	    }
           for (ie = node->indirect_calls; ie; ie = ie->next_callee)
 	    if (ie->can_throw_external)
-	      can_throw = true;
+	      {
+	        can_throw = true;
+		break;
+	      }
 	  w_info = (struct ipa_dfs_info *) w->symbol.aux;
 	  w = w_info->next_cycle;
 	}