public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][RFC] target/61810 - disable init-regs pass on targets using LRA
@ 2021-08-11 14:33 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-08-11 14:33 UTC (permalink / raw)
  To: gcc-patches; +Cc: ebotcazou, richard.sandiford

This patch disables the init-regs pass on targets using LRA.
It's not clear as to what issue the init-regs papers over and
most definitely LRA should get it right.  This leaves targets
still using reload unaffected but will expose any such LRA
bug if it exists, allowing it to be identified and fixed.

The change can cause testsuite fallout since the explicit
initializations can have an effect on passes like combine.
For example on x86_64 this results in

+FAIL: gcc.target/i386/extract-insert-combining.c scan-assembler-times (?:vmovd|
movd)[ \\\\t]+[^{\\n]*%xmm[0-9] 3
+FAIL: gcc.target/i386/extract-insert-combining.c scan-assembler-times (?:vpinsr
d|pinsrd)[ \\\\t]+[^{\\n]*%xmm[0-9] 1

it also results in yet unanalyzed

+FAIL: gnat.dg/sso8.adb execution test

I welcome trying this change on other architectures, like
for example 'arm' that's singled out in the init-regs comments
as affected architecture.

Bootstrapped and tested on x86_64-unknown-linux-gnu with all languages
and {,-m32} with the above remaining fallout (I fixed another
testism already).

2021-08-11  Richard Biener  <rguenther@suse.de>

	PR target/61810
	* init-regs.c (pass_initialize_regs::gate): Gate on
	targetm.lra_p ().
---
 gcc/init-regs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/init-regs.c b/gcc/init-regs.c
index 72e898f3e33..8f038f54fff 100644
--- a/gcc/init-regs.c
+++ b/gcc/init-regs.c
@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "memmodel.h"
 #include "emit-rtl.h"
 #include "expr.h"
+#include "target.h"
 #include "tree-pass.h"
 
 /* Check all of the uses of pseudo variables.  If any use that is MUST
@@ -153,7 +154,7 @@ public:
   {}
 
   /* opt_pass methods: */
-  virtual bool gate (function *) { return optimize > 0; }
+  virtual bool gate (function *) { return optimize > 0 && !targetm.lra_p (); }
   virtual unsigned int execute (function *)
     {
       initialize_uninitialized_regs ();
-- 
2.31.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-11 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 14:33 [PATCH][RFC] target/61810 - disable init-regs pass on targets using LRA Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).