This is the mail archive of the 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] cse.c: Remove an optimization that never triggers.


Attached is a patch to remove an optimization that never triggers.

The condition of the "if" statement that this patch is removing is
never true during bootstrap and make-check of i686-pc-linux-gnu and

Plus, even if this optimization triggered, this would be
simplification of a control-flow instruction based on no information
except that from INSN itself, which sounds like a CFG cleanup's job.

The patch removes the optimization and teaches fold_rtx to return X
early if PC is passed.  Note that the rest of fold_rtx never deals
with PC.

According to CVS (both the current one and old-gcc), this optimization
is hardly ever touched except when somebody is sweeping through the
whole GCC to make mechanical changes.

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

Kazu Hirata

2005-01-27  Kazu Hirata  <>

	* cse.c (fold_rtx) <PC>: Don't optimize.

Index: cse.c
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.332
diff -u -d -p -r1.332 cse.c
--- cse.c	26 Jan 2005 12:44:58 -0000	1.332
+++ cse.c	27 Jan 2005 12:48:56 -0000
@@ -3253,6 +3253,7 @@ fold_rtx (rtx x, rtx insn)
     case SYMBOL_REF:
     case LABEL_REF:
     case REG:
+    case PC:
       /* No use simplifying an EXPR_LIST
 	 since they are used only for lists of args
 	 in a function call's REG_EQUAL note.  */
@@ -3264,17 +3265,6 @@ fold_rtx (rtx x, rtx insn)
       return prev_insn_cc0;
-    case PC:
-      /* If the next insn is a CODE_LABEL followed by a jump table,
-	 PC's value is a LABEL_REF pointing to that label.  That
-	 lets us fold switch statements on the VAX.  */
-      {
-	rtx next;
-	if (insn && tablejump_p (insn, &next, NULL))
-	  return gen_rtx_LABEL_REF (Pmode, next);
-      }
-      break;
     case SUBREG:
       /* See if we previously assigned a constant value to this SUBREG.  */
       if ((new = lookup_as_function (x, CONST_INT)) != 0

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