[Bug tree-optimization/66610] Compound assignments prevent value-numbering optimization with unions
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Jun 20 09:53:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list