This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] simplify-rtx: Fix compare of comparisons (PR60818)


On 03/31/2017 03:40 PM, Segher Boessenkool wrote:
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.

Bootstrapped and tested on powerpc64-linux {-m32,-m64} (and tested the
new testcase with {-m32,-m64}{,-misel}).  Is this okay for trunk?


Segher


2017-03-31  Segher Boessenkool  <segher@kernel.crashing.org>

	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.
Doesn't seem like a regression. But I can't see how it could possibly result in any correctness issues -- the absolute worst would be a performance issue and even that seems highly unlikely.

OK for the trunk if you think it's worth fixing for gcc-7. Else it's pre-approved for gcc-8.


jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]