[PATCH] constrain one character optimization to one character stores (PR 90989)
Richard Biener
richard.guenther@gmail.com
Thu Jun 27 18:40:00 GMT 2019
On June 27, 2019 7:04:32 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>On Thu, Jun 27, 2019 at 10:58:25AM -0600, Martin Sebor wrote:
>> The LHS is unsigned short so handle_char_store would not be called
>> because of the check in the caller. You would need something like:
>>
>> MEM <char[2]> [(char *)&x] = { 'a', 'b' };
>
>This is invalid, because the rhs is non-empty CONSTRUCTOR that doesn't
>have
>VECTOR_TYPE - verify_gimple_assign_single has:
> case CONSTRUCTOR:
> if (TREE_CODE (rhs1_type) == VECTOR_TYPE)
>...
> else if (CONSTRUCTOR_NELTS (rhs1) != 0)
> {
> error ("non-vector %qs with elements", code_name);
> debug_generic_stmt (rhs1);
> return true;
> }
>
>But
> MEM <char[2]> [(char *)&x] = MEM <char[2]> [(char *)"ab"];
>is valid. Or = {} would be valid too, even for array stores.
And you can of course write GIMPLE unit tests for the pass using the GIMPLE FE.
Richard.
> Jakub
More information about the Gcc-patches
mailing list