diff mbox series

[committed] Fix mode_for_size units in caller-save.c (PR83761)

Message ID 87lgh4soqt.fsf@linaro.org
State New
Headers show
Series [committed] Fix mode_for_size units in caller-save.c (PR83761) | expand

Commit Message

Richard Sandiford Jan. 11, 2018, 9:56 a.m. UTC
The new opt_mode asserts triggered for replace_reg_with_saved_mem
because it was passing bytes rather than bits to mode_for_size.
Previously we ended up with a BLKmode register instead, but
presumably that didn't matter because this is "only" used for
debug insns.

Tested on bfin-elf (as far as possible); this code isn't used
for LRA targets.  Applied as obvious.

Richard


2018-01-11  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	PR rtl-optimization/83761
	* caller-save.c (replace_reg_with_saved_mem): Pass bits rather
	than bytes to mode_for_size.
diff mbox series

Patch

Index: gcc/caller-save.c
===================================================================
--- gcc/caller-save.c	2018-01-03 21:42:44.552647435 +0000
+++ gcc/caller-save.c	2018-01-11 09:49:29.873718858 +0000
@@ -1147,7 +1147,8 @@  replace_reg_with_saved_mem (rtx *loc,
 	    machine_mode smode = save_mode[regno];
 	    gcc_assert (smode != VOIDmode);
 	    if (hard_regno_nregs (regno, smode) > 1)
-	      smode = mode_for_size (exact_div (GET_MODE_SIZE (mode), nregs),
+	      smode = mode_for_size (exact_div (GET_MODE_BITSIZE (mode),
+						nregs),
 				     GET_MODE_CLASS (mode), 0).require ();
 	    XVECEXP (mem, 0, i) = gen_rtx_REG (smode, regno + i);
 	  }