This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/52009] Another missed tail merging opportunity


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

--- Comment #1 from vries at gcc dot gnu.org 2012-01-30 09:43:04 UTC ---
Value numbering of stores appears to be a bit different than what I expected.

pr51879-9.c:
...
int z;

void
foo (void)
{
  z = 5;
  z = 5;
}
...

pr51879-9.c.028t.fre:
...
SCC consists of: .MEM_1(D) 
Setting value number of .MEM_1(D) to .MEM_1(D) (changed)
SCC consists of: .MEM_2 
Value numbering .MEM_2 stmt = z = 5;
RHS 5 simplified to 5
No store match
Value numbering store z to 5
Setting value number of .MEM_2 to .MEM_2 (changed)
SCC consists of: .MEM_3 
Value numbering .MEM_3 stmt = z = 5;
RHS 5 simplified to 5
Store matched earlier value,value numbering store vdefs to matching vuses.
Setting value number of .MEM_3 to .MEM_2 (changed)
Value numbers:
.MEM_3 = .MEM_2
...

Value numbering .MEM_2 stmt = z = 5:
...
2796            vn_reference_insert (lhs, op, vdef);
(gdb) call debug_generic_expr (lhs)
z
(gdb) call debug_generic_expr (op)
5
(gdb) call debug_generic_expr (vdef)
.MEM_2
...
or 5 = GVN<z, .MEM_2>

Value numbering .MEM_3 stmt = z = 5:
...
2761      result = vn_reference_lookup (lhs, gimple_vuse (stmt), VN_NOWALK,
NULL);
(gdb) call debug_generic_expr (lhs)
z
(gdb) call debug_generic_expr (gimple_vuse (stmt))
.MEM_2
(gdb) n
(gdb) call debug_generic_expr (result)
5
...

The value numbering we need for this PR is more like:
.MEM_2 = GVN<z, 5, .MEM_1(D)>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]