Hi, 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. Thanks, Martin 2012-06-27 Martin Jambor <mjam...@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)) return; - 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)) return; ipa_set_jf_known_type (jfunc, offset, TREE_TYPE (base), TREE_TYPE (op));