[Bug c/79674] Missed optimisation when no sequence point present

prathamesh3492 at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 22 13:51:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79674

prathamesh3492 at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |prathamesh3492 at gcc dot gnu.org

--- Comment #1 from prathamesh3492 at gcc dot gnu.org ---
Well since vol_str is qualified with volatile, I suppose optimizations were
suppressed. After removing volatile, the store-merging pass converted four byte
writes into a single 32-bit write for both fct1 and fct2 as can be seen from
the dump below:

;; Function fct1 (fct1, funcdef_no=1, decl_uid=1804, cgraph_uid=1,
symbol_order=2)

Coalescing successful!
Merged into 1 stores
New sequence of 1 stmts to replace old one of 4 stmts
Merging successful!
fct1 ()
{
  <bb 2> [100.00%]:
  MEM[(unsigned char *)&vol_str] = 197121;
  return;

}

;; Function fct2 (fct2, funcdef_no=2, decl_uid=1807, cgraph_uid=2,
symbol_order=3)

Coalescing successful!
Merged into 1 stores
New sequence of 1 stmts to replace old one of 4 stmts
Merging successful!
fct2 ()
{
  <bb 2> [100.00%]:
  MEM[(unsigned char *)&vol_str] = 197121;
  return;

}

Thanks,
Prathamesh


More information about the Gcc-bugs mailing list