Commit 544dafa6 by Martin Liska Committed by Martin Liska

re PR ipa/64146 (ipa-icf breaks gold dynamic_test_2 test)

Fix for PR ipa/64146

	PR ipa/64146
	* ipa-icf.c (sem_function::merge): Check for
	decl_binds_to_current_def_p is newly added to merge operation.
	* g++.dg/ipa/pr64146.C: New test.

From-SVN: r218860
parent 72c122a2
2014-12-18 Martin Liska <mliska@suse.cz>
PR ipa/64146
* ipa-icf.c (sem_function::merge): Check for
decl_binds_to_current_def_p is newly added to merge operation.
2014-12-18 Bin Cheng <bin.cheng@arm.com> 2014-12-18 Bin Cheng <bin.cheng@arm.com>
PR tree-optimization/62178 PR tree-optimization/62178
...@@ -101,6 +101,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -101,6 +101,7 @@ along with GCC; see the file COPYING3. If not see
#include <list> #include <list>
#include "ipa-icf-gimple.h" #include "ipa-icf-gimple.h"
#include "ipa-icf.h" #include "ipa-icf.h"
#include "varasm.h"
using namespace ipa_icf_gimple; using namespace ipa_icf_gimple;
...@@ -624,6 +625,13 @@ sem_function::merge (sem_item *alias_item) ...@@ -624,6 +625,13 @@ sem_function::merge (sem_item *alias_item)
return false; return false;
} }
if (!decl_binds_to_current_def_p (alias->decl))
{
if (dump_file)
fprintf (dump_file, "Declaration does not bind to currect definition.\n\n");
return false;
}
if (redirect_callers) if (redirect_callers)
{ {
/* If alias is non-overwritable then /* If alias is non-overwritable then
......
2014-12-18 Martin Liska <mliska@suse.cz>
* g++.dg/ipa/pr64146.C: New test.
2014-12-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2014-12-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* lib/mpx-dg.exp (check_effective_target_mpx): Change into link test. * lib/mpx-dg.exp (check_effective_target_mpx): Change into link test.
......
/* { dg-do compile } */
/* { dg-require-alias "" } */
/* { dg-options "-fpic -fdump-ipa-icf-details -fipa-icf" } */
extern "C" const char*
foo()
{
return "original";
}
const char*
test_foo()
{
return foo();
}
extern "C" const char*
bar()
{
return "original";
}
const char*
test_bar()
{
return bar();
}
int main (int argc, char **argv)
{
test_foo ();
test_bar ();
return 0;
}
/* { dg-final { scan-ipa-dump-times "Declaration does not bind to currect definition." 2 "icf" } } */
/* { dg-final { scan-ipa-dump "Equal symbols: 2" "icf" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment