]> git.ipfire.org Git - thirdparty/gcc.git/commit
Extend subst to simplify CONST_INT inside SIGN_EXTEND.
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Oct 2019 18:41:35 +0000 (18:41 +0000)
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 11 Oct 2019 18:41:35 +0000 (18:41 +0000)
commite654502098fd8ea8da7f61e158fddcaad3b71303
tree8edde92f02bb6cb265ce4e27485bfee556f20ece
parentb2924dad7c1e825458fef7ba9c6564fecf57d7c1
Extend subst to simplify CONST_INT inside SIGN_EXTEND.

This addresses PR 91860 which has four testcases triggering internal errors.
The problem here is that in combine when handling debug insns, we are trying
to substitute
(sign_extend:DI (const_int 8160 [0x1fe0]))
as the value for
(reg:DI 78 [ _9 ])
in the debug insn
(debug_insn 29 28 30 2 (var_location:QI d (subreg:QI (reg:DI 78 [ _9 ]) 0)) "tmp4.c":11:5 -1
     (nil))
This eventually triggers an abort because 8160 is not a sign-extended
QImode value.

In subst there is already code check for a CONST_INT inside a ZERO_EXTEND and
simplify it.  This needs to be extended to also handle a SIGN_EXTEND the same
way.

gcc/
PR rtl-optimization/91860
* combine.c (subst): If new_rtx is a constant, also check for
SIGN_EXTEND when deciding whether to call simplify_unary_operation.

gcc/testsuite/
PR rtl-optimization/91860
* gcc.dg/pr91860-1.c: New testcase.
* gcc.dg/pr91860-2.c: New testcase.
* gcc.dg/pr91860-3.c: New testcase.
* gcc.dg/pr91860-4.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@276901 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr91860-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr91860-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr91860-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/pr91860-4.c [new file with mode: 0644]