diff mbox series

combine: Use correct mode in new comparison (PR86902)

Message ID d1f6dbbbe66f3df2d6e9b4f3e310ef3d4ef05c25.1537376236.git.segher@kernel.crashing.org
State New
Headers show
Series combine: Use correct mode in new comparison (PR86902) | expand

Commit Message

Segher Boessenkool Sept. 19, 2018, 5:35 p.m. UTC
This code in try_combine uses the wrong mode.  This fails (with RTL
checking) in trunk, but not in any released branches.

Committing to trunk.


Segher


2018-09-19  Segher Boessenkool  <segher@kernel.crashing.org>

	* combine.c (try_combine): When changing the CC mode used, don't change
	an unrelated mode in other_insn to that new CC mode.

---
 gcc/combine.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/combine.c b/gcc/combine.c
index d3f7143..256b5a4 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -3338,7 +3338,7 @@  try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 		{
 		  /* Replace cc_use_loc with entire new RTX.  */
 		  SUBST (*cc_use_loc,
-			 gen_rtx_fmt_ee (compare_code, compare_mode,
+			 gen_rtx_fmt_ee (compare_code, GET_MODE (*cc_use_loc),
 					 newpat_dest, const0_rtx));
 		  undobuf.other_insn = cc_use_insn;
 		}
@@ -3347,7 +3347,7 @@  try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 		  /* Just replace the CC reg with a new mode.  */
 		  SUBST (XEXP (*cc_use_loc, 0), newpat_dest);
 		  undobuf.other_insn = cc_use_insn;
-		}	      
+		}
 	    }
 
 	  /* Now we modify the current newpat: