Patchwork [4.6,PR,38474] Avoid unnecessary vdef walks in compute_known_type_jump_func

login
register
mail settings
Submitter Martin Jambor
Date June 29, 2012, 2:21 p.m.
Message ID <20120629142141.GB3893@virgil.arch.suse.de>
Download mbox | patch
Permalink /patch/168113/
State New
Headers show

Comments

Martin Jambor - June 29, 2012, 2:21 p.m.
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.  I have posted a patch for trunk and 4.7 just
a moment ago.  this is a version for 4.6, doing essentially the same
thing.

I am about to bootstrap and test it on x86_64-linux and if no-one
objects, I will commit it to the branch on Monday because it is also
rather obvious and quite like the approved patch for newer code.

Thanks,

Martin


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

	pr middle-end/38474
	* ipa-prop.c (compute_known_type_jump_func): Check for a BINFO before
	checking for a dynamic type change.

Patch

Index: gcc/ipa-prop.c
===================================================================
--- gcc/ipa-prop.c	(revision 189050)
+++ gcc/ipa-prop.c	(working copy)
@@ -704,12 +704,11 @@  compute_known_type_jump_func (tree op, s
       || is_global_var (base))
     return;
 
-  if (detect_type_change (op, base, call, jfunc, offset))
-    return;
-
   binfo = TYPE_BINFO (TREE_TYPE (base));
-  if (!binfo)
+  if (!binfo
+      || detect_type_change (op, base, call, jfunc, offset))
     return;
+
   binfo = get_binfo_at_offset (binfo, offset, TREE_TYPE (op));
   if (binfo)
     {