This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] expr.c: Remove an "if" whose condition is always false.


Hi,

Attached is a patch to remove an "if" whose condition is always false.

TRUTH_ANDIF_EXPR and TRUTH_ORIF_EXPR are lowered by gimplify.c, so the
condition of the "if" statement removed by this patch is always false.

I am not adding any new gcc_unreachable because we already have one
later in the function:

    case TRUTH_ANDIF_EXPR:
    case TRUTH_ORIF_EXPR:
      /* Lowered by gimplify.c.  */
      gcc_unreachable ();

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2004-12-06  Kazu Hirata  <kazu@cs.umass.edu>

	* expr.c (expand_expr_real_1): Remove an "if" whose condition
	is always false.

Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.754
diff -u -d -p -r1.754 expr.c
--- expr.c	4 Dec 2004 00:20:30 -0000	1.754
+++ expr.c	5 Dec 2004 15:54:16 -0000
@@ -6507,12 +6507,6 @@ expand_expr_real_1 (tree exp, rtx target
 	  expand_expr (TREE_OPERAND (exp, 1), const0_rtx, VOIDmode, modifier);
 	  return const0_rtx;
 	}
-      else if ((code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR)
-	       && ! TREE_SIDE_EFFECTS (TREE_OPERAND (exp, 1)))
-	/* If the second operand has no side effects, just evaluate
-	   the first.  */
-	return expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
-			    modifier);
       else if (code == BIT_FIELD_REF)
 	{
 	  expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]