This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/34043] Missed optimization causing extra loads and stores when using x86_64 builtin function together with aggregate types.
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Jan 2008 15:35:59 -0000
- Subject: [Bug tree-optimization/34043] Missed optimization causing extra loads and stores when using x86_64 builtin function together with aggregate types.
- References: <bug-34043-14442@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #10 from rguenth at gcc dot gnu dot org 2008-01-04 15:35 -------
We can 'abuse' PREs inserting of fake stores machinery to handle the case in
PR33989, where for
union a
{
int i;
float f;
};
void f (float *a, int *b)
{
union a c;
c.f = *a;
*b = c.i;
}
we then get (PRE)
<bb 2>:
# VUSE <SMT.6_5(D)>
D.1549_2 = *a_1(D);
# SFT.0_8 = VDEF <SFT.0_6(D)>
# SFT.1_9 = VDEF <SFT.1_7(D)>
c.f = D.1549_2;
uniontmp.12_13 = VIEW_CONVERT_EXPR<int>(D.1549_2);
D.1550_3 = uniontmp.12_13;
# SMT.7_11 = VDEF <SMT.7_10(D)>
*b_4(D) = D.1550_3;
return;
and before expand:
<bb 2>:
# SMT.7_11 = VDEF <SMT.7_10(D)>
*b = VIEW_CONVERT_EXPR<int>(*a);
return;
and finally
f:
.LFB2:
movl (%rdi), %eax
movl %eax, (%rsi)
ret
but we need to make sure VN processes the inserted conversions (which do
not have uses) and we need to enhance PREs poolification of trees to
handle COMPONENT_REFs (and possibly more).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34043