[Bug rtl-optimization/66152] [9 Regression] suboptimal load bytes to stack

2019-02-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #9 from Jakub Jelinek  ---
Should be fixed for 9+ (and should work in 8.x too).

[Bug rtl-optimization/66152] [9 Regression] suboptimal load bytes to stack

2019-02-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152

--- Comment #8 from Jakub Jelinek  ---
Author: jakub
Date: Sat Feb 16 11:20:33 2019
New Revision: 268957

URL: https://gcc.gnu.org/viewcvs?rev=268957&root=gcc&view=rev
Log:
PR rtl-optimization/66152
* builtins.h (c_readstr): Declare.
* builtins.c (c_readstr): Remove forward declaration.  Add
null_terminated_p argument, if false, read all bytes from the
string instead of stopping after '\0'.
* expr.c (string_cst_read_str): New function.
(store_expr): Use string_cst_read_str instead of
builtin_strncpy_read_str.  Try to store by pieces the whole
exp_len first, and only if that fails, split it up into
store by pieces followed by clear_storage.  Formatting fix.

* gcc.target/i386/pr66152.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/i386/pr66152.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/builtins.h
trunk/gcc/expr.c
trunk/gcc/testsuite/ChangeLog

[Bug rtl-optimization/66152] [9 Regression] suboptimal load bytes to stack

2019-02-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #7 from Jakub Jelinek  ---
Created attachment 45729
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45729&action=edit
gcc9-pr66152.patch

Untested fix to handle '\0's embedded at the start of in the middle of
STRING_CSTs when storing it into memory.

[Bug rtl-optimization/66152] [9 Regression] suboptimal load bytes to stack

2019-02-15 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66152

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-02-15
Version|unknown |9.0
   Target Milestone|--- |9.0
Summary|suboptimal load bytes to|[9 Regression] suboptimal
   |stack   |load bytes to stack
 Ever confirmed|0   |1

--- Comment #6 from Jakub Jelinek  ---
That only happens if there is '\0' embedded in the created string before end.
Anyway, this makes it a regression.