From 47a668cd26bc8efaddf56ba18b2255f0b271c507 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Thu, 30 Oct 2014 11:10:58 +0100 Subject: [PATCH] re PR tree-optimization/63574 (ICE building libjava (segfault) on arm-linux-gnueabihf) PR ipa/63574 PR ipa/63664 * g++.dg/ipa/pr63574.C: New test. * ipa-icf-gimple.c (func_checker::parse_labels): Missing comment added. (func_checker::compare_gimple_label): Simlified comparison introduced. * ipa-icf-gimple.h: Missing comment added. From-SVN: r216913 --- gcc/ChangeLog | 8 +++++ gcc/ipa-icf-gimple.c | 7 ++++- gcc/ipa-icf-gimple.h | 2 ++ gcc/testsuite/ChangeLog | 6 ++++ gcc/testsuite/g++.dg/ipa/pr63574.C | 47 ++++++++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr63574.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 373b44209bc..d587890fa73 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-10-30 Martin Liska + + PR ipa/63574 + PR ipa/63664 + * ipa-icf-gimple.c (func_checker::parse_labels): Missing comment added. + (func_checker::compare_gimple_label): Simlified comparison introduced. + * ipa-icf-gimple.h: Missing comment added. + 2014-10-30 Jeff Law * config/pa/pa-protos.h (pa_output_arg_descriptor): Strengthen diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index d3f379557f1..ecb96671fb7 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -527,6 +527,10 @@ func_checker::compare_variable_decl (tree t1, tree t2) return return_with_debug (ret); } + +/* Function visits all gimple labels and creates corresponding + mapping between basic blocks and labels. */ + void func_checker::parse_labels (sem_bb *bb) { @@ -765,7 +769,8 @@ func_checker::compare_gimple_label (gimple g1, gimple g2) if (FORCED_LABEL (t1) || FORCED_LABEL (t2)) return return_false_with_msg ("FORCED_LABEL"); - return compare_tree_ssa_label (t1, t2); + /* As the pass build BB to label mapping, no further check is needed. */ + return true; } /* Verifies for given GIMPLEs S1 and S2 that diff --git a/gcc/ipa-icf-gimple.h b/gcc/ipa-icf-gimple.h index 8487a2ad745..5811bd132f0 100644 --- a/gcc/ipa-icf-gimple.h +++ b/gcc/ipa-icf-gimple.h @@ -145,6 +145,8 @@ public: /* Memory release routine. */ ~func_checker(); + /* Function visits all gimple labels and creates corresponding + mapping between basic blocks and labels. */ void parse_labels (sem_bb *bb); /* Basic block equivalence comparison function that returns true if diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a362f135782..2c290daa8e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-10-30 Martin Liska + + PR ipa/63574 + PR ipa/63664 + * g++.dg/ipa/pr63574.C: New test. + 2014-10-29 Kyrylo Tkachov * gcc.target/aarch64/madd_after_asm_1.c: New test. diff --git a/gcc/testsuite/g++.dg/ipa/pr63574.C b/gcc/testsuite/g++.dg/ipa/pr63574.C new file mode 100644 index 00000000000..59b82d53ba8 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr63574.C @@ -0,0 +1,47 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +class test +{ +public: + test (int val, int *p) + { + int_val = *p; + bool_val = (val != int_val); + } + + ~test () + { + if (!bool_val) + return; + } + + int get_int_val () const + { + return int_val; + } + +private: + bool bool_val; + int int_val; +}; + +static int __attribute__ ((noinline)) +f1 (int i, int *p) +{ + test obj (i, p); + return obj.get_int_val (); +} + +static int __attribute__ ((noinline)) +f2 (int i, int *p) +{ + test obj (i, p); + return obj.get_int_val (); +} + +int +f (int i, int *p) +{ + return f1 (i, p) + f2 (i, p); +} -- 2.30.2