diff mbox

Fix wrong code on aarch64 due to paradoxical subreg

Message ID AM4PR0701MB2162ACF059105ED396C6EC06E4060@AM4PR0701MB2162.eurprd07.prod.outlook.com
State New
Headers show

Commit Message

Bernd Edlinger Aug. 3, 2016, 5:41 p.m. UTC
On 08/03/16 17:38, Jeff Law wrote:
> cse.c changes look good, but I'd really like to see a testcase for each
> issue in the dejagnu framework.  Extra points if you tried to build a
> unit test using David M's framework, but that isn't required.
>
> The testcase from 70903 ought to be trivial to add to the dejagnu suite.
>   71779 might be more difficult, but if you could take a stab, it'd be
> appreciated.
>


Yes, sure.  I had assumed that the pr70903 test case is using some
target-specific vector types, but now I see that it even works as-is in
the gcc.c-torture/execute directory.

So I've added the test case to the cse patch.  And quickly verified that
it works on x86_64-linux-gnu.


The pr71779 test case will be pretty difficult to reduce, because it
depends on combine to do the incorrect transformation and lra to spill
the subreg, and on the stack content at runtime to be non-zero.

But technically it *is* already in the isl-test suite, so if isl is
in-tree, it is always executed by make check or make check-isl.

It is just that gmp/mpfr/mpc and isl test results are not included by
contrib/test_summary, but that should be fixable.  What do you think?

Actually that should not be too difficult, as there are test-suite.log
files that we could just added to the test_summary output as-is, for
instance:

cat isl/test-suite.log

==================================
    isl 0.16.1: ./test-suite.log
==================================

# TOTAL: 5
# PASS:  5
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2


Are the patches OK now?


Thanks
Bernd.

Comments

Jeff Law Aug. 3, 2016, 10:08 p.m. UTC | #1
On 08/03/2016 11:41 AM, Bernd Edlinger wrote:
> On 08/03/16 17:38, Jeff Law wrote:
>> cse.c changes look good, but I'd really like to see a testcase for each
>> issue in the dejagnu framework.  Extra points if you tried to build a
>> unit test using David M's framework, but that isn't required.
>>
>> The testcase from 70903 ought to be trivial to add to the dejagnu suite.
>>   71779 might be more difficult, but if you could take a stab, it'd be
>> appreciated.
>>
>
>
> Yes, sure.  I had assumed that the pr70903 test case is using some
> target-specific vector types, but now I see that it even works as-is in
> the gcc.c-torture/execute directory.
>
> So I've added the test case to the cse patch.  And quickly verified that
> it works on x86_64-linux-gnu.
>
>
> The pr71779 test case will be pretty difficult to reduce, because it
> depends on combine to do the incorrect transformation and lra to spill
> the subreg, and on the stack content at runtime to be non-zero.
>
> But technically it *is* already in the isl-test suite, so if isl is
> in-tree, it is always executed by make check or make check-isl.
>
> It is just that gmp/mpfr/mpc and isl test results are not included by
> contrib/test_summary, but that should be fixable.  What do you think?
>
> Actually that should not be too difficult, as there are test-suite.log
> files that we could just added to the test_summary output as-is, for
> instance:
>
> cat isl/test-suite.log
>
> ==================================
>     isl 0.16.1: ./test-suite.log
> ==================================
>
> # TOTAL: 5
> # PASS:  5
> # SKIP:  0
> # XFAIL: 0
> # FAIL:  0
> # XPASS: 0
> # ERROR: 0
>
> .. contents:: :depth: 2
>
>
> Are the patches OK now?
Yes.  Thanks for taking care of this...

Jeff
diff mbox

Patch

2016-08-01  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	PR rtl-optimization/71779
	* emit-rtl.c (set_reg_attrs_from_value): Only propagate REG_POINTER,
	if the value was sign-extended according to POINTERS_EXTEND_UNSIGNED
	or if it was truncated.

Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c	(revision 238915)
+++ gcc/emit-rtl.c	(working copy)
@@ -1156,7 +1156,11 @@  set_reg_attrs_from_value (rtx reg, rtx x)
     {
 #if defined(POINTERS_EXTEND_UNSIGNED)
       if (((GET_CODE (x) == SIGN_EXTEND && POINTERS_EXTEND_UNSIGNED)
-	   || (GET_CODE (x) != SIGN_EXTEND && ! POINTERS_EXTEND_UNSIGNED))
+	   || (GET_CODE (x) == ZERO_EXTEND && ! POINTERS_EXTEND_UNSIGNED)
+	   || (paradoxical_subreg_p (x)
+	       && ! (SUBREG_PROMOTED_VAR_P (x)
+		     && SUBREG_CHECK_PROMOTED_SIGN (x,
+						    POINTERS_EXTEND_UNSIGNED))))
 	  && !targetm.have_ptr_extend ())
 	can_be_reg_pointer = false;
 #endif