PR tree-optimization/44687 (partial inlining and nrv at i386)

Jan Hubicka hubicka@ucw.cz
Mon Jun 28 12:52:00 GMT 2010


Hi,
the problem here is that ipa-split when building new return statement it use ordinary var
to pass return value where RESULT_DECL is expected.
Fixed thus.  It might be nice to extend statement verifier to check this, but I am not
sure when exactly we insist on RESULT_DECL and when not. (for aggregates or in more complex
scenarios?)

Bootstrapped/regtested x86_64-linux, OK?
Honza

typedef int int32_t;                                                                                                                                                   
typedef unsigned char uint8_t;                                                                                                                                         
struct S0                                                                                                                                                              
{                                                                                                                                                                      
  uint8_t f0;                                                                                                                                                          
};                                                                                                                                                                     
struct S0 *g_18[7][5][1][1] = {                                                                                                                                        
};                                                                                                                                                                     
                                                                                                                                                                       
struct S0 **g_17 = &g_18[0][3][0][0];                                                                                                                                  
int32_t g_86;                                                                                                                                                          
struct S0 func_72 (uint8_t p_73, struct S0 p_74);                                                                                                                      
                                                                                                                                                                       
void int326 (struct S0 **p_67, int32_t p_68, int32_t * *const p_69,                                                                                                    
        struct S0 *p_70)                                                                                                                                               
{                                                                                                                                                                      
  struct S0 l_95 = {                                                                                                                                                   
    -1L                                                                                                                                                                
  };                                                                                                                                                                   
  func_72 (1L, func_72 (0, l_95));                                                                                                                                     
}                                                                                                                                                                      
                                                                                                                                                                       
struct S0                                                                                                                                                              
func_72 (uint8_t p_73, struct S0 p_74)                                                                                                                                 
{                                                                                                                                                                      
  int32_t *l_85 = &g_86;                                                                                                                                               
  if (*l_85)                                                                                                                                                           
  lbl_94:*l_85 ^= 0;                                                                                                                                                   
  if (g_86)                                                                                                                                                            
    goto lbl_94;                                                                                                                                                       
  return **g_17;                                                                                                                                                       
}   
	PR tree-optimization/44687
	* ipa-split.c (split_function): Use DECL_RESULT to store return value.
Index: ipa-split.c
===================================================================
--- ipa-split.c	(revision 161476)
+++ ipa-split.c	(working copy)
@@ -928,9 +928,7 @@ split_function (struct split_point *spli
 	  gimple ret;
 	  if (!VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))))
 	    {
-	      retval
-	        = create_tmp_var (TREE_TYPE (TREE_TYPE (current_function_decl)),
-				  "RET");
+	      retval = DECL_RESULT (current_function_decl);
 	      if (is_gimple_reg (retval))
 		retval = make_ssa_name (retval, call);
 	      gimple_call_set_lhs (call, retval);



More information about the Gcc-patches mailing list