This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/66610] Compound assignments prevent value-numbering optimization with unions
- From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 20 Jun 2015 09:53:08 +0000
- Subject: [Bug tree-optimization/66610] Compound assignments prevent value-numbering optimization with unions
- Auto-submitted: auto-generated
- References: <bug-66610-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66610
--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Created attachment 35820
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35820&action=edit
A less minimal example
FWIW, here's a less minimal example, better showing what the code was doing
(interpreter values were a union plus a type code).
As in the previous example, fre2 is able to do this optimization of the copy of
arr[1] to arr[0] when doing the copy field-wise:
Replaced arr_6(D)->union_field.int_field with i_1 in all uses of _10 =
arr_6(D)->union_field.int_field;
Replaced arr_6(D)->type_code with 0 in all uses of _13 = arr_6(D)->type_code;
turning the loop body into:
<bb 3>:
arr_6(D)->union_field.int_field = i_1;
arr_6(D)->type_code = 0;
MEM[(struct value *)arr_6(D) + 16B].union_field.int_field = i_1;
MEM[(struct value *)arr_6(D) + 16B].type_code = 0;
i_15 = i_1 + 1;
allowing the loop to later be optimized away by cddce2.