gold: Make Ordering::operator() even more complex

Message ID 20200131233236.119312-1-hjl.tools@gmail.com
State New
Headers show
Series
  • gold: Make Ordering::operator() even more complex
Related show

Commit Message

H.J. Lu Jan. 31, 2020, 11:32 p.m.
GCC 9 generates the same function size for Ordering::operator() in
odr_violation1.cc and odr_violation2.cc on x32:

  134: 00000000    31 FUNC    WEAK   DEFAULT   64 _ZN8OrderingclEii
   40: 00000000    31 FUNC    GLOBAL DEFAULT   10 _ZN8OrderingclEii

This patch makes Ordering::operator() even more complex

   134: 00000000    31 FUNC    WEAK   DEFAULT   64 _ZN8OrderingclEii
    42: 00000000    35 FUNC    GLOBAL DEFAULT   11 _ZN8OrderingclEii

    	* testsuite/odr_violation2.cc (Ordering::operator()): Make
	expression even more complex.
---
 gold/testsuite/odr_violation2.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.24.1

Comments

Alan Modra via Binutils May 1, 2020, 3:57 p.m. | #1
On Fri, Jan 31, 2020 at 3:32 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>

> GCC 9 generates the same function size for Ordering::operator() in

> odr_violation1.cc and odr_violation2.cc on x32:

>

>   134: 00000000    31 FUNC    WEAK   DEFAULT   64 _ZN8OrderingclEii

>    40: 00000000    31 FUNC    GLOBAL DEFAULT   10 _ZN8OrderingclEii

>

> This patch makes Ordering::operator() even more complex

>

>    134: 00000000    31 FUNC    WEAK   DEFAULT   64 _ZN8OrderingclEii

>     42: 00000000    35 FUNC    GLOBAL DEFAULT   11 _ZN8OrderingclEii

>

>         * testsuite/odr_violation2.cc (Ordering::operator()): Make

>         expression even more complex.

> ---

>  gold/testsuite/odr_violation2.cc | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/gold/testsuite/odr_violation2.cc b/gold/testsuite/odr_violation2.cc

> index aa9868fc27c..35dd454704b 100644

> --- a/gold/testsuite/odr_violation2.cc

> +++ b/gold/testsuite/odr_violation2.cc

> @@ -12,7 +12,7 @@ class Ordering {

>  bool Ordering::operator()(int a, int b) {

>    // Optimization makes this operator() a different size than the one

>    // in odr_violation1.cc.

> -  return a + 12345 > b / 67;

> +  return (a * 30 + b + 12345) > b / 67;

>  }

>

>  void SortDescending(int array[], int size) {

> --

> 2.24.1

>


I am checking in this patch.

-- 
H.J.

Patch

diff --git a/gold/testsuite/odr_violation2.cc b/gold/testsuite/odr_violation2.cc
index aa9868fc27c..35dd454704b 100644
--- a/gold/testsuite/odr_violation2.cc
+++ b/gold/testsuite/odr_violation2.cc
@@ -12,7 +12,7 @@  class Ordering {
 bool Ordering::operator()(int a, int b) {
   // Optimization makes this operator() a different size than the one
   // in odr_violation1.cc.
-  return a + 12345 > b / 67;
+  return (a * 30 + b + 12345) > b / 67;
 }
 
 void SortDescending(int array[], int size) {