simplify-rtx: Fix compare of comparisons (PR60818)
authorSegher Boessenkool <segher@kernel.crashing.org>
Tue, 4 Apr 2017 00:10:02 +0000 (02:10 +0200)
committerSegher Boessenkool <segher@gcc.gnu.org>
Tue, 4 Apr 2017 00:10:02 +0000 (02:10 +0200)
commit833bbf60ce6414801d3a381a2a4b1f244bd0d969
tree00a63283331bcb8c6dec0cee8f6b8600a0a657bf
parent5764ee3c8491e3ecff855a319f781a66fca2484e
simplify-rtx: Fix compare of comparisons (PR60818)

The function simplify_binary_operation_1 has code that does
/* Convert (compare (gt (flags) 0) (lt (flags) 0)) to (flags).  */
but this transformation is only valid if "flags" has the same machine
mode as the outer compare.  This fixes it.

PR rtl-optimization/60818
* simplify-rtx.c (simplify_binary_operation_1): Do not replace
a compare of comparisons with the thing compared if this results
in a different machine mode.

gcc/testsuite/
PR rtl-optimization/60818
* gcc.c-torture/compile/pr60818.c: New testcase.

From-SVN: r246666
gcc/ChangeLog
gcc/simplify-rtx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr60818.c [new file with mode: 0644]