diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5760eece241395bec8f43057bba11a87abebedcb..0ed638774710bd143b89f57fc7daad60f1016374 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2004-05-03  Richard Henderson  <rth@redhat.com>
+
+	PR middle-end/21318
+	* function.c (instantiate_virtual_regs_in_insn): Use the mode
+	from recog_data instead of insn_data.
+
 2005-05-03  DJ Delorie  <dj@redhat.com>
 
 	* common.opt (fdiagnostics-show-option): No variable is needed.
diff --git a/gcc/function.c b/gcc/function.c
index 065c1244e9d698daa22da9bcd0be5964e1ca0516..6bc33442d7b51497c23366b39269d99f66d2d910 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1485,8 +1485,8 @@ instantiate_virtual_regs_in_insn (rtx insn)
 	      end_sequence ();
 	      emit_insn_before (seq, insn);
 	    }
-	  x = simplify_gen_subreg (insn_data[insn_code].operand[i].mode,
-				   new, GET_MODE (new), SUBREG_BYTE (x));
+	  x = simplify_gen_subreg (recog_data.operand_mode[i], new,
+				   GET_MODE (new), SUBREG_BYTE (x));
 	  break;
 
 	default: