This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/43491] Unnecessary temporary for global register variable
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Feb 2012 14:43:51 +0000
- Subject: [Bug tree-optimization/43491] Unnecessary temporary for global register variable
- Auto-submitted: auto-generated
- References: <bug-43491-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43491
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-02-16 14:43:51 UTC ---
With tree hoisting we generate
<bb 2>:
pretmp.5_19 = data_0;
pretmp.5_20 = data_3;
i_21 = pretmp.5_19 + pretmp.5_20;
if (data_3(D) != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
<bb 4>:
# v_1 = PHI <v_7(D)(3), 2(2)>
# i_2 = PHI <i_21(3), 5(2)>
D.1719_14 = v_1 * i_21;
D.1718_15 = i_2 * D.1719_14;
return D.1718_15;
instead of
<bb 2>:
if (data_3(D) != 0)
goto <bb 4>;
else
goto <bb 3>;
<bb 3>:
pretmp.5_19 = data_0;
pretmp.5_21 = data_3;
i_23 = pretmp.5_19 + pretmp.5_21;
goto <bb 5>;
<bb 4>:
data_0.0_4 = data_0;
data_3.1_5 = data_3;
i_6 = data_0.0_4 + data_3.1_5;
<bb 5>:
# v_1 = PHI <v_7(D)(4), 2(3)>
# i_2 = PHI <i_6(4), 5(3)>
# i_24 = PHI <i_6(4), i_23(3)>
D.1719_14 = v_1 * i_24;
D.1718_15 = i_2 * D.1719_14;
return D.1718_15;
}
I suppose that's good enough? See that PRE still inserts loads from
register variables, not sure if you'd want to disallow that as well.