]> gcc.gnu.org Git - gcc.git/commit
tree-dse: Fix mem* head trimming if call has lhs [PR94130]
authorJakub Jelinek <jakub@redhat.com>
Thu, 12 Mar 2020 08:34:00 +0000 (09:34 +0100)
committerJakub Jelinek <jakub@redhat.com>
Thu, 17 Sep 2020 14:20:25 +0000 (16:20 +0200)
commit9001bc36447e015283a5f1a0a924bd355f9d9df3
treed9f4e3f3219f7823f4aa4b8d9ed6466e9a14ada9
parent4910b2e4cfe25c95fef18cf54125b788c190cfb2
tree-dse: Fix mem* head trimming if call has lhs [PR94130]

As the testcase shows, if DSE decides to head trim {mem{set,cpy,move},strncpy}
and the call has lhs, it is incorrect to leave the lhs as is, because it
will then point to the adjusted address (base + head_trim) instead of the
original base.
The following patch fixes that by dropping the lhs of the call and assigning
lhs the original base in a following statement.

2020-03-12  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/94130
* tree-ssa-dse.c: Include gimplify.h.
(increment_start_addr): If stmt has lhs, drop the lhs from call and
set it after the call to the original value of the first argument.
Formatting fixes.
(decrement_count): Formatting fix.

* gcc.c-torture/execute/pr94130.c: New test.

(cherry picked from commit a545ffafa380fa958393e1dfbf7f5f8f129bc5cf)
gcc/testsuite/gcc.c-torture/execute/pr94130.c [new file with mode: 0644]
gcc/tree-ssa-dse.c
This page took 0.073649 seconds and 6 git commands to generate.