Patchwork Fix speculative edge reference lookup

login
register
mail settings
Submitter Jan Hubicka
Date Aug. 31, 2013, 2:05 p.m.
Message ID <20130831140552.GD12966@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/271535/
State New
Headers show

Comments

Jan Hubicka - Aug. 31, 2013, 2:05 p.m.
Hi,
this patch fixes ugly thinko when looking up reference for a speculative call.
Without LTO we can end up choosing wrong alternative for function with many devirtualizations
(as it happens for PPC64)

Bootstrapped/regtested ppc64-linux, comitted.

Honza

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 202128)
+++ ChangeLog	(working copy)
@@ -1,5 +1,9 @@ 
 2013-08-31  Jan Hubicka  <jh@suse.cz>
 
+	* cgraph.c (cgraph_speculative_call_info): Fix ref lookup
+
+2013-08-31  Jan Hubicka  <jh@suse.cz>
+
 	* basic-block.h (apply_scale): Make scale parmeter gcov_type.
 
 2013-08-31  Uros Bizjak  <ubizjak@gmail.com>
Index: cgraph.c
===================================================================
--- cgraph.c	(revision 202100)
+++ cgraph.c	(working copy)
@@ -1151,7 +1151,7 @@  cgraph_speculative_call_info (struct cgr
 					      i, ref); i++)
     if (ref->speculative
 	&& ((ref->stmt && ref->stmt == e->call_stmt)
-	    || (ref->lto_stmt_uid == e->lto_stmt_uid)))
+	    || (!ref->stmt && ref->lto_stmt_uid == e->lto_stmt_uid)))
       {
 	reference = ref;
 	break;