Regimplification enhancements 3/3
Richard Biener
richard.guenther@gmail.com
Mon Jun 16 11:38:00 GMT 2014
On Mon, Jun 16, 2014 at 12:57 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> There's code in regimplification that makes us use an extra temporary
> when we encounter a call returning a non-BLKmode structure. This seems
> somewhat inefficient and unnecessary, and when used from the
> lower-addr-spaces pass I'm working on it leads to problems further
> down that look like tree-ssa bugs that I wasn't able to clearly
> disentangle.
>
> Here's what happens on compile/pr51761.c. Regimplification has the
> following effect, creating an extra temporary _6:
>
> - D.1378 = fooD.1373 (aD.1377);
> + _6 = fooD.1373 (aD.1377);
> + # .MEMD.1382 = VDEF <.MEMD.1382>
> + D.1378 = _6;
>
> SRA turns this into:
>
> _6 = fooD.1373 (aD.1377);
> # VUSE <.MEM_3>
> SR$2_7 = MEM[(struct S *)&_6];
clearly bogus - _6 is a register, you can't use a MEM on it.
> Somehow, the address of &_6 doesn't count as a use, and the DCE pass decides
> it is unused:
>
> Eliminating unnecessary statements:
> Deleting LHS of call: _6 = foo (a);
>
> However, the statement
> SR$2_7 = MEM[(struct S *)&_6];
> is still present, and we have an SSA name without a definition, leading to a
> crash.
>
> Rather than figure all this out, I decided to try making the
> regimplification not generate the extra copy in the first place. The
> testsuite seems to agree with me that it's unnecessary. Bootstrapped and
> tested on x86_64-linux, ok?
Ok. The code looks bogus anyway in that it generates a SSA name
for sth not is_gimple_reg_type ().
Thanks,
Richard.
>
> Bernd
More information about the Gcc-patches
mailing list