fix aarch64/combine bootstrap miscompare

Message ID
State New
Headers show

Commit Message

Jim Wilson March 18, 2017, 5:48 a.m.
We get different code for libcpp/line-map.o in stage2 and stage3,
because stage2 is compiled with -gtoggle and stage3 is not.  Bernd's
recent combine patch is being confused by debug insns.  This is fixed
by changing a prev_nonnote_insn call to a prev_nonnote_nondebug_insn
call.  There is also a redundant test for i1 that I've removed.

This was tested with an x86_64 bootstrap, aarch64 bootstrap, and
aarch64 make check.  I noticed 3 new failures as a result of the
combine patch that need to be looked at
FAIL: scan-assembler tst\t(x|w)[0-9]+,[ \t]*255
FAIL: scan-assembler tst\t(x|w)[0-9]+,[ \t]*65535
FAIL: scan-assembler tst\t(x|w)[0-9]+,[ \t]*65535
The testcases are expecting a tst instruction to be generated, but we
get and/cmp instead.  I think this is because combinations with a hard
reg are now disabled in some cases.  I haven't had a chance to look at
this in detail yet.

The patch was preapproved by Jeff and has been checked in.



2017-03-17  Jim Wilson  <>

	* combine.c (try_combine): Delete redundant i1 test.  Call
	prev_nonnote_nondebug_insn instead of prev_nonnote_insn.

Index: gcc/combine.c
--- gcc/combine.c	(revision 246226)
+++ gcc/combine.c	(working copy)
@@ -2806,9 +2806,8 @@ 
 	bitmap_set_bit (links_regset, ll->regno);
       FOR_EACH_LOG_LINK (ll, i2)
 	bitmap_set_bit (links_regset, ll->regno);
-      if (i1)
-	FOR_EACH_LOG_LINK (ll, i1)
-	  bitmap_set_bit (links_regset, ll->regno);
+      FOR_EACH_LOG_LINK (ll, i1)
+	bitmap_set_bit (links_regset, ll->regno);
       if (i0)
 	FOR_EACH_LOG_LINK (ll, i0)
 	  bitmap_set_bit (links_regset, ll->regno);
@@ -4142,7 +4141,7 @@ 
 	   multi-word registers.  Later, when fixing up LOG_LINKS, we
 	   deal with the case where a pseudo use moved.  */
 	if (!bitmap_empty_p (new_regs_in_i2)
-	    && prev_nonnote_insn (i3) != i2
+	    && prev_nonnote_nondebug_insn (i3) != i2
 	    && bitmap_first_set_bit (new_regs_in_i2) < FIRST_PSEUDO_REGISTER)
 	    undo_all ();