[trunk,4.7,PR,38474] Avoid unnecessary vdef walks in compute_known_type_jump_func

Message ID 20120629141731.GA3893@virgil.arch.suse.de
State New
Headers show

Commit Message

Martin Jambor June 29, 2012, 2:17 p.m.

PR 38474 testcase revealed what we can do a lot of entirely
unnecessary vdef walking only to throw away the result later because
of a much cheaper check.  This patch fixes that.

The patch applies to both trunk and the 4.7 branch, I have
bootstrapped and tested it on both on an x86_64-linux without any
problems.  Because of Richi's comment #63 in bugzilla, I assume it is
approved for both trunk and the branch too and will commit it on
Monday, unless someone objects.



2012-06-27  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/38474
	* ipa-prop.c (compute_known_type_jump_func): Put BINFO check before a
	dynamic type change check.


Index: src/gcc/ipa-prop.c
--- src.orig/gcc/ipa-prop.c
+++ src/gcc/ipa-prop.c
@@ -912,8 +912,8 @@  compute_known_type_jump_func (tree op, s
       || is_global_var (base))
-  if (detect_type_change (op, base, call, jfunc, offset)
-      || !TYPE_BINFO (TREE_TYPE (base)))
+  if (!TYPE_BINFO (TREE_TYPE (base))
+      || detect_type_change (op, base, call, jfunc, offset))
   ipa_set_jf_known_type (jfunc, offset, TREE_TYPE (base), TREE_TYPE (op));