[gcc(refs/users/marxin/heads/marxin-gcc-benchmark-branch)] arm: fix rtl checking bootstrap (PR target/93312)

Martin Liska marxin@gcc.gnu.org
Mon Mar 30 10:14:41 GMT 2020


https://gcc.gnu.org/g:a22a86a18bd3946f59f46468344fe86d6756103e

commit a22a86a18bd3946f59f46468344fe86d6756103e
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Jan 18 09:41:59 2020 +0100

    arm: fix rtl checking bootstrap (PR target/93312)
    
    As reported in PR93312, the:
    > > > > > >         * config/arm/arm.c (clear_operation_p): New function.
    change broke RTL checking bootstrap.
    
    On the testcase from the PR (which is distilled from libgcc2.c, so I think
    we don't need to add it into testsuite) we ICE because SET_DEST (elt) is
    not a REG, but SUBREG.  The code uses REGNO on it, which is invalid, but
    only stores it into a variable, then performs REG_P (reg) check,
    determines it is not a REG and bails early.
    
    The following patch just moves the regno variable initialization after that
    check, it isn't used in between.  And, as a small optimization, because
    reg doesn't change, doesn't use REGNO (reg) a second time to set last_regno.
    
    2020-01-18  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/93312
            * config/arm/arm.c (clear_operation_p): Don't use REGNO until
            after checking the argument is a REG.  Don't use REGNO (reg)
            again to set last_regno, reuse regno variable instead.

Diff:
---
 gcc/ChangeLog        | 17 ++++++++++++-----
 gcc/config/arm/arm.c |  5 +++--
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d837e95509a..001e26d12de 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,8 +1,15 @@
+2020-01-18  Jakub Jelinek  <jakub@redhat.com>
+
+	PR target/93312
+	* config/arm/arm.c (clear_operation_p): Don't use REGNO until
+	after checking the argument is a REG.  Don't use REGNO (reg)
+	again to set last_regno, reuse regno variable instead.
+
 2020-01-17  David Malcolm  <dmalcolm@redhat.com>
 
 	* doc/analyzer.texi (Limitations): Add note about NaN.
 
-2020-01-17  Mihail-Calin Ionescu <mihail.ionescu@arm.com>
+2020-01-17  Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
 	    Sudakshina Das  <sudi.das@arm.com>
 
 	* config/arm/arm.md (ashldi3): Generate thumb2_lsll for both reg
@@ -202,8 +209,8 @@
 	* config/arm/t-rmprofile: Map v8.1-M multilibs to v8-M.
 	* doc/invoke.texi: Document the armv8.1-m mve and dps options.
 
-2020-01-16  Mihail-Calin Ionescu <mihail.ionescu@arm.com>
-	    Thomas Preud'homme <thomas.preudhomme@arm.com>
+2020-01-16  Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
+	    Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
 	* config/arm/arm-cpus.in (ARMv8_1m_main): Redefine as an extension to
 	Armv8-M Mainline.
@@ -312,8 +319,8 @@
 	* config/arm/vfp.md (push_fpsysreg_insn): New define_insn.
 	(pop_fpsysreg_insn): Likewise.
 
-2020-01-16  Mihail-Calin Ionescu <mihail.ionescu@arm.com>
-	    Thomas Preud'homme <thomas.preudhomme@arm.com>
+2020-01-16  Mihail-Calin Ionescu  <mihail.ionescu@arm.com>
+	    Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
 	* config/arm/arm-cpus.in (armv8_1m_main): New feature.
 	(ARMv4, ARMv4t, ARMv5t, ARMv5te, ARMv5tej, ARMv6, ARMv6j, ARMv6k,
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 6ead410d1a8..c47fc232f39 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -13779,7 +13779,6 @@ clear_operation_p (rtx op, bool vfp)
 	return false;
 
       reg = SET_DEST (elt);
-      regno = REGNO (reg);
       zero = SET_SRC (elt);
 
       if (!REG_P (reg)
@@ -13787,6 +13786,8 @@ clear_operation_p (rtx op, bool vfp)
 	  || zero != CONST0_RTX (SImode))
 	return false;
 
+      regno = REGNO (reg);
+
       if (vfp)
 	{
 	  if (i != 1 && regno != last_regno + 1)
@@ -13800,7 +13801,7 @@ clear_operation_p (rtx op, bool vfp)
 	    return false;
 	}
 
-      last_regno = REGNO (reg);
+      last_regno = regno;
     }
 
   return true;


More information about the Gcc-cvs mailing list