------- Comment #6 from rguenth at gcc dot gnu dot org 2006-02-14 15:52 ------- Created an attachment (id=10849) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10849&action=view) simple "cleanup" struct copyprop
Attached simple "cleanup" style struct copyprop that is able to clean up useless copys inserted by inlining and gimplification (mostly happens for C++). It handles both tmp = X; Y = tmp; to tmp = X; Y = X; (commented code to remove tmp = X is there, but one needs to somehow check if the store is to a global var - DCE will happily clean up after us though) and tmp = X; X = tmp; to tmp = X; (happens a few times in gcc itself, same comment as above). This looks like a thing we should do after/inside inlining in ssa form. Note that this patch doesn't require dominator information (which would enable us to relax the stmt ordering by checking if the final store dominates all kills of X - i.e. to prevent propagation in the case of # tmpD.1530_3 = V_MUST_DEF <tmpD.1530_2>; # VUSE <aD.1524_1>; tmpD.1530 = aD.1524; # aD.1524_5 = V_MUST_DEF <aD.1524_1>; # VUSE <bD.1525_4>; aD.1524 = bD.1525; # cD.1526_7 = V_MUST_DEF <cD.1526_6>; # VUSE <tmpD.1530_3>; cD.1526 = tmpD.1530; as aD.1524 is not in SSA form and so the value used in stmt 1 is no longer available) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14295