diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-04-06 18:42:52 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-04-06 18:42:52 +0200 |
commit | 61bee6aed26eb30b798c75b9a595c9d51e080442 (patch) | |
tree | a45736fd6973fa6b60af91a9656e718509080cfc /gcc/config.gcc | |
parent | 9fd377a747375a82912bd81c67b275301489785c (diff) | |
download | gcc-61bee6aed26eb30b798c75b9a595c9d51e080442.zip gcc-61bee6aed26eb30b798c75b9a595c9d51e080442.tar.gz gcc-61bee6aed26eb30b798c75b9a595c9d51e080442.tar.bz2 |
combine: Don't record for UNDO_MODE pointers into regno_reg_rtx array [PR104985]
The testcase in the PR fails under valgrind on mips64 (but only Martin
can reproduce, I couldn't).
But the problem reported there is that SUBST_MODE remembers addresses
into the regno_reg_rtx array, then some splitter needs a new pseudo
and calls gen_reg_rtx, which reallocates the regno_reg_rtx array
and finally undo operation is done and dereferences the old regno_reg_rtx
entry.
The rtx values stored in regno_reg_rtx array seems to be created
by gen_reg_rtx only and since then aren't modified, all we do for it
is adjusting its fields (e.g. adjust_reg_mode that SUBST_MODE does).
So, I think it is useless to use where.r for UNDO_MODE and store
®no_reg_rtx[regno] in struct undo, we can store just
regno_reg_rtx[regno] (i.e. pointer to the REG itself instead of
pointer to pointer to REG) or could also store just the regno.
The following patch does the latter, and because SUBST_MODE no longer
needs to be a macro, changes all SUBST_MODE uses to subst_mode.
2022-04-06 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/104985
* combine.cc (struct undo): Add where.regno member.
(do_SUBST_MODE): Rename to ...
(subst_mode): ... this. Change first argument from rtx * into int,
operate on regno_reg_rtx[regno] and save regno into where.regno.
(SUBST_MODE): Remove.
(try_combine): Use subst_mode instead of SUBST_MODE, change first
argument from regno_reg_rtx[whatever] to whatever. For UNDO_MODE, use
regno_reg_rtx[undo->where.regno] instead of *undo->where.r.
(undo_to_marker): For UNDO_MODE, use regno_reg_rtx[undo->where.regno]
instead of *undo->where.r.
(simplify_set): Use subst_mode instead of SUBST_MODE, change first
argument from regno_reg_rtx[whatever] to whatever.
Diffstat (limited to 'gcc/config.gcc')
0 files changed, 0 insertions, 0 deletions