Patchwork Remove duplicate check on BRANCH_COST in fold-const.c

login
register
mail settings
Submitter Bin Cheng
Date July 26, 2012, 10:20 a.m.
Message ID <001801cd6b18$3b7e1c00$b27a5400$@cheng@arm.com>
Download mbox | patch
Permalink /patch/173394/
State New
Headers show

Comments

Bin Cheng - July 26, 2012, 10:20 a.m.
Hi,
This patch removes the duplicate check on BRANCH_COST in fold_truth_andor.
The BRANCH_COST condition removed is a duplicate of the default definition
of LOGICAL_OP_NON_SHORT_CIRCUIT.
All current targets (mips and rs6000) that provide non-default definitions
of LOGICAL_OP_SHORT_CIRCUIT set it to 0, so this patch is therefore just a
code cleanup and does not change behaviour in the compiler.

I built mipsel-elf cross compiler and compared newlib/libstdc++ compiled by
the patched/original compilers.

Is it OK?

Thanks

2012-07-26  Bin Cheng  <bin.cheng@arm.com>

	* fold-const.c (fold_truth_andor) Remove duplicated check on
BRANCH_COST.

Patch

Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c	(revision 189835)
+++ gcc/fold-const.c	(working copy)
@@ -8443,9 +8443,7 @@ 
   if ((tem = fold_truth_andor_1 (loc, code, type, arg0, arg1)) != 0)
     return tem;
 
-  if ((BRANCH_COST (optimize_function_for_speed_p (cfun),
-		    false) >= 2)
-      && LOGICAL_OP_NON_SHORT_CIRCUIT
+  if (LOGICAL_OP_NON_SHORT_CIRCUIT
       && (code == TRUTH_AND_EXPR
           || code == TRUTH_ANDIF_EXPR
           || code == TRUTH_OR_EXPR