]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
compiler: don't inline integer expressions with named types
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 25 Oct 2019 19:10:34 +0000 (19:10 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 25 Oct 2019 19:10:34 +0000 (19:10 +0000)
This works around the problem on GCC 9 branch.  The problem is fixed
in a better way on trunk; see https://golang.org/issue/34577.

Fixes https://golang.org/issue/35154

From-SVN: r277461

gcc/go/gofrontend/expressions.cc

index 6f9775dd5a20c7d48c8f1dbbe4ba9bb00921459a..859c1ece5da9836b69ba1f78b5ea06a0ff5d4f6f 100644 (file)
@@ -2036,7 +2036,11 @@ class Integer_expression : public Expression
 
   int
   do_inlining_cost() const
-  { return 1; }
+  {
+    if (this->type_ != NULL && this->type_->named_type() != NULL)
+      return 0x100000;
+    return 1; 
+  }
 
   void
   do_export(Export_function_body*) const;
@@ -2451,7 +2455,11 @@ class Float_expression : public Expression
 
   int
   do_inlining_cost() const
-  { return 1; }
+  {
+    if (this->type_ != NULL && this->type_->named_type() != NULL)
+      return 0x100000;
+    return 1;
+  }
 
   void
   do_export(Export_function_body*) const;
@@ -2664,7 +2672,11 @@ class Complex_expression : public Expression
 
   int
   do_inlining_cost() const
-  { return 2; }
+  {
+    if (this->type_ != NULL && this->type_->named_type() != NULL)
+      return 0x100000;
+    return 2;
+  }
 
   void
   do_export(Export_function_body*) const;