[Bug middle-end/19616] [4.0 regression] missed tail call

steven at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Jan 25 16:07:00 GMT 2005


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-25 16:07 -------
With "-O2" at the time the patch for PR15387 was applied, we had the 
following .optimized tree for sister: 
 
;; Function sister (sister) 
 
sister (f, b) 
{ 
  int * tmp; 
  int T.2; 
  int T.1; 
  int * f.0; 
 
<bb 0>: 
  f.0 = (int *)&f; 
  brother (*(f.0 + 4B) == b, b) [tail call]; 
  return; 
 
} 
 
 
That resulted in this RTL: 
 
(insn 3 8 4 0 (set (reg/v:SI 59 [ b ]) 
        (mem/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) 
                (const_int 12 [0xc])) [2 b+0 S4 A32])) -1 (nil) 
    (expr_list:REG_EQUIV (mem/i:SI (plus:SI (reg/f:SI 53 
virtual-incoming-args) 
                (const_int 12 [0xc])) [2 b+0 S4 A32]) 
        (nil))) 
 
(insn 11 9 13 1 (set (reg:SI 58 [ f.0 ]) 
        (reg/f:SI 53 virtual-incoming-args)) -1 (nil) 
    (nil)) 
 
(insn 15 14 16 1 (set (mem/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) 
                (const_int 4 [0x4])) [0 S4 A32]) 
        (reg/v:SI 59 [ b ])) -1 (nil) 
    (nil)) 
 
(insn 16 15 17 1 (set (reg:SI 61) 
        (mem:SI (plus:SI (reg:SI 58 [ f.0 ]) 
                (const_int 4 [0x4])) [2 S4 A32])) -1 (nil) 
    (nil)) 
 
So reg 61 gets set to the value of 'b' that just got stored in *(f.0 + 4). 
 
CVS today generates this tree dump and RTL: 
;; Function sister (sister) 
 
Analyzing Edge Insertions. 
sister (f, b) 
{ 
  int f$c; 
  int f$a; 
  int f$b; 
  int * tmp; 
  int D.1134; 
  int D.1133; 
 
<bb 0>: 
  brother (b == f.b, b) [tail call]; 
  return; 
 
} 
 
 
(insn 3 6 4 0 (set (reg/v:SI 58 [ b ]) 
        (mem/i:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) 
                (const_int 12 [0xc])) [3 b+0 S4 A32])) -1 (nil) 
    (expr_list:REG_EQUIV (mem/i:SI (plus:SI (reg/f:SI 53 
virtual-incoming-args) 
                (const_int 12 [0xc])) [3 b+0 S4 A32]) 
        (nil))) 
 
(insn 17 7 18 1 (set (mem:SI (plus:SI (reg/f:SI 56 virtual-outgoing-args) 
                (const_int 4 [0x4])) [0 S4 A32]) 
        (reg/v:SI 58 [ b ])) -1 (nil) 
    (nil)) 
 
(insn 18 17 19 1 (set (reg:SI 63) 
        (mem/s:SI (plus:SI (reg/f:SI 53 virtual-incoming-args) 
                (const_int 4 [0x4])) [3 f.b+0 S4 A32])) -1 (nil) 
    (nil)) 
 
 
Note how b is now stored to virtual-*outgoing*-args. 
 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19616



More information about the Gcc-bugs mailing list