From b779a874835529f43d70951bd1eca7e057eb317e Mon Sep 17 00:00:00 2001
From: Andrew Pinski <pinskia@gmail.com>
Date: Fri, 15 Dec 2006 07:48:10 -0800
Subject: [PATCH] re PR tree-optimization/30140 (inliner produces invalid
 gimple with promoted types)

2006-12-15  Andrew Pinski  <pinski@gmail.com>

        PR tree-opt/30140
        * tree-inline.c (setup_one_parameter): Gimplify the statement if
        the variable is not a gimple register variable.

From-SVN: r119883
---
 gcc/ChangeLog     | 6 ++++++
 gcc/tree-inline.c | 3 ++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8dcc9e2dd2c4..70f82d9db8fc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-15  Andrew Pinski  <pinski@gmail.com>
+
+	PR tree-opt/30140
+	* tree-inline.c (setup_one_parameter): Gimplify the statement if
+	the variable is not a gimple register variable.
+
 2006-12-15  Uros Bizjak  <ubizjak@gmail.com>
 
 	* invoke.texi (mstringop-strategy): Add missing "byte_loop" value.
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 4e0913e4efc1..39d9f11cc7db 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1106,9 +1106,10 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn,
 	 at the end.  Note that is_gimple_cast only checks the outer
 	 tree code, not its operand.  Thus the explicit check that its
 	 operand is a gimple value.  */
-      if (!is_gimple_val (rhs)
+      if ((!is_gimple_val (rhs)
 	  && (!is_gimple_cast (rhs)
 	      || !is_gimple_val (TREE_OPERAND (rhs, 0))))
+	  || !is_gimple_reg (var))
 	gimplify_stmt (&init_stmt);
 
       /* If VAR represents a zero-sized variable, it's possible that the
-- 
GitLab