From 366ee94b445fd959c7947e45d2cb9a2a4a0b4509 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 15 Apr 2015 13:47:44 +0200 Subject: [PATCH] re PR ipa/65765 (Compiling Firefox with GCC 5 leads to broken javascript engine on x86-64) PR ipa/65765 * ipa-icf-gimple.c (func_checker::compare_bb): For GIMPLE_NOP and GIMPLE_PREDICT use break instead of return true. For GIMPLE_EH_DISPATCH, compare dispatch region. * g++.dg/ipa/pr65765.C: New test. From-SVN: r222123 --- gcc/ChangeLog | 7 +++++ gcc/ipa-icf-gimple.c | 6 +++- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/ipa/pr65765.C | 45 ++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr65765.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 27ddea52396..f1a96f270b5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-04-15 Jakub Jelinek + + PR ipa/65765 + * ipa-icf-gimple.c (func_checker::compare_bb): For GIMPLE_NOP + and GIMPLE_PREDICT use break instead of return true. For + GIMPLE_EH_DISPATCH, compare dispatch region. + 2015-04-14 Matthew Wahab * doc/extend.texi (__sync Builtins): Simplify some text. Update diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 09adce3d3ec..9efdea465c2 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -706,7 +706,11 @@ func_checker::compare_bb (sem_bb *bb1, sem_bb *bb2) return return_different_stmts (s1, s2, "GIMPLE_SWITCH"); break; case GIMPLE_DEBUG: + break; case GIMPLE_EH_DISPATCH: + if (gimple_eh_dispatch_region (as_a (s1)) + != gimple_eh_dispatch_region (as_a (s2))) + return return_different_stmts (s1, s2, "GIMPLE_EH_DISPATCH"); break; case GIMPLE_RESX: if (!compare_gimple_resx (as_a (s1), @@ -734,7 +738,7 @@ func_checker::compare_bb (sem_bb *bb1, sem_bb *bb2) break; case GIMPLE_PREDICT: case GIMPLE_NOP: - return true; + break; default: return return_false_with_msg ("Unknown GIMPLE code reached"); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a007f32bb9a..1df85887f66 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-04-15 Jakub Jelinek + + PR ipa/65765 + * g++.dg/ipa/pr65765.C: New test. + 2015-04-15 Nick Clifton * gcc.target/rx/builtins.c: Disable RMPA test if string diff --git a/gcc/testsuite/g++.dg/ipa/pr65765.C b/gcc/testsuite/g++.dg/ipa/pr65765.C new file mode 100644 index 00000000000..ff8dc33a1a4 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr65765.C @@ -0,0 +1,45 @@ +// PR ipa/65765 +// { dg-do run } +// { dg-options "-O2" } + +int a, b, c, d, e; +unsigned char h[] = { 1, 1 }; + +__attribute__ ((cold)) int ModRM_Mode () { return a; } + +int +ModRM_RM (int p1) +{ + return p1; +} + +__attribute__ ((cold)) static bool ModRM_hasSIB (unsigned char p1) +{ + return ModRM_Mode () != 1 && ModRM_RM (p1); +} + +__attribute__ ((cold)) static bool ModRM_hasRIP (unsigned char p1) +{ + return ModRM_Mode () && ModRM_RM (p1); +} + +unsigned char * +DisassembleHeapAccess (unsigned char *p1) +{ + b = *p1++; + if (ModRM_hasSIB (b)) + c = *p1++; + int f = c, g = 0; + d = ModRM_hasRIP (g); + e = f == 0; + if (e) + p1 += sizeof 0; + return p1; +} + +int +main () +{ + if (DisassembleHeapAccess (h) != h + 2) + __builtin_abort (); +} -- 2.30.2