[PATCH] Fix copy_to_reg ICE in expand_expr
Ulrich Weigand
Ulrich.Weigand@de.ibm.com
Fri Jan 25 12:27:00 GMT 2002
Richard Henderson wrote:
>This is ok, but
>
>> if (temp != original_target)
>> temp = copy_to_reg (temp);
>
>we should nonetheless use copy_to_mode_reg here.
Hmm, the question is, which mode? Is this one OK?
(It bootstrapped/regtested on s390-ibm-linux ...)
Bye,
Ulrich
Index: gcc/expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.414
diff -c -p -r1.414 expr.c
*** expr.c 2002/01/24 01:16:23 1.414
--- expr.c 2002/01/25 19:18:38
*************** expand_expr (exp, target, tmode, modifie
*** 7922,7929 ****
temp = expand_expr (TREE_OPERAND (exp, 0), original_target,
VOIDmode, 0);
if (temp != original_target)
! temp = copy_to_reg (temp);
op1 = gen_label_rtx ();
emit_cmp_and_jump_insns (temp, const0_rtx, EQ, NULL_RTX,
--- 7922,7946 ----
temp = expand_expr (TREE_OPERAND (exp, 0), original_target,
VOIDmode, 0);
+ /* If temp is constant, we can just compute the result. */
+ if (GET_CODE (temp) == CONST_INT)
+ {
+ if (INTVAL (temp) != 0)
+ emit_move_insn (target, const1_rtx);
+ else
+ emit_move_insn (target, const0_rtx);
+
+ return target;
+ }
+
if (temp != original_target)
! {
! enum machine_mode mode1 = GET_MODE (temp);
! if (mode1 == VOIDmode)
! mode1 = tmode != VOIDmode ? tmode : mode;
!
! temp = copy_to_mode_reg (mode1, temp);
! }
op1 = gen_label_rtx ();
emit_cmp_and_jump_insns (temp, const0_rtx, EQ, NULL_RTX,
More information about the Gcc-patches
mailing list