[PR114415][scheduler]: Fixing wrong code generation
commita24476422ba311b83737cf8bdc5892a7fc7514eb
authorVladimir N. Makarov <vmakarov@redhat.com>
Thu, 4 Apr 2024 20:04:04 +0000 (4 16:04 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Thu, 4 Apr 2024 20:07:10 +0000 (4 16:07 -0400)
tree16f9aa6f9f673beccf8d9835bb67866efb33014d
parent7520a4992c94254016085a461c58c972497c4483
[PR114415][scheduler]: Fixing wrong code generation

  For the test case, the insn scheduler (working for live range
shrinkage) moves insns modifying stack memory before an insn reserving
the stack memory. Comments in the patch contains more details about
the problem and its solution.

gcc/ChangeLog:

PR rtl-optimization/114415
* sched-deps.cc (add_insn_mem_dependence): Add memory check for mem argument.
(sched_analyze_1): Treat stack pointer modification as memory read.
(sched_analyze_2, sched_analyze_insn): Add memory guard for processing pending_read_mems.
* sched-int.h (deps_desc): Add comment to pending_read_mems.

gcc/testsuite/ChangeLog:

PR rtl-optimization/114415
* gcc.target/i386/pr114415.c: New test.
gcc/sched-deps.cc
gcc/sched-int.h
gcc/testsuite/gcc.target/i386/pr114415.c [new file with mode: 0644]