diff --git a/external/gpl3/gcc/dist/gcc/dse.c b/external/gpl3/gcc/dist/gcc/dse.c
index cbc0838a465a..cd60edd031a8 100644
--- a/external/gpl3/gcc/dist/gcc/dse.c
+++ b/external/gpl3/gcc/dist/gcc/dse.c
@@ -1954,6 +1954,7 @@ static void
 check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
 {
   rtx mem = *loc, mem_addr;
+  machine_mode mem_mode;
   insn_info_t insn_info;
   HOST_WIDE_INT offset = 0;
   HOST_WIDE_INT width = 0;
@@ -1986,10 +1987,8 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
       return;
     }
 
-  if (GET_MODE (mem) == BLKmode)
-    width = -1;
-  else
-    width = GET_MODE_SIZE (GET_MODE (mem));
+  mem_mode = GET_MODE (mem);
+  width = (mem_mode == BLKmode) ? -1 : GET_MODE_SIZE (mem_mode);
 
   read_info = read_info_type_pool.allocate ();
   read_info->group_id = group_id;
@@ -2017,7 +2016,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
 
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
-	  if (width == -1)
+          if (mem_mode == BLKmode)
 	    fprintf (dump_file, " processing const load gid=%d[BLK]\n",
 		     group_id);
 	  else
@@ -2048,7 +2047,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
 	    {
 	      /* This is a block mode load.  We may get lucky and
 		 canon_true_dependence may save the day.  */
-	      if (width == -1)
+              if (mem_mode == BLKmode)
 		remove
 		  = canon_true_dependence (store_info->mem,
 					   GET_MODE (store_info->mem),
@@ -2064,7 +2063,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
 		      && offset + width <= store_info->end
 		      && all_positions_needed_p (store_info,
 						 offset - store_info->begin,
-						 width)
+                                                 GET_MODE_SIZE (mem_mode))
 		      && replace_read (store_info, i_ptr, read_info,
 				       insn_info, loc, bb_info->regs_live))
 		    return;
@@ -2127,11 +2126,12 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info)
 	  if (store_info->rhs
 	      && store_info->group_id == -1
 	      && store_info->cse_base == base
-	      && width != -1
+              && mem_mode != BLKmode
 	      && offset >= store_info->begin
 	      && offset + width <= store_info->end
 	      && all_positions_needed_p (store_info,
-					 offset - store_info->begin, width)
+                                         offset - store_info->begin,
+                                         GET_MODE_SIZE (mem_mode))
 	      && replace_read (store_info, i_ptr,  read_info, insn_info, loc,
 			       bb_info->regs_live))
 	    return;
