summaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-23 02:57:26 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-01-23 02:57:26 +0000
commitc7926a824cfe7ee75d14440282d6d15d83dcd6f8 (patch)
treee350e7cda96af13a3c7a7347f5f121cef549541c /gcc/cse.c
parent45baea8bdc127498d928bff521be446e7d595dff (diff)
downloadgcc-c7926a824cfe7ee75d14440282d6d15d83dcd6f8.tar.gz
PR optimization/8423
* cse.c (fold_rtx): Only eliminate a CONSTANT_P_RTX to 1 when its argument is constant, or 0 if !flag_gcse. * simplify-rtx.c (simplify_rtx): Convert CONSTANT_P_RTX to 1 if it's argument is constant. * gcse.c (want_to_gcse_p): Ignore CONSTANT_P_RTX nodes. (hash_scan_set): Don't record CONSTANT_P_RTX expressions. (do_local_cprop): Don't propagate CONSTANT_P_RTX constants. * builtins.c (purge_builtin_constant_p): New function to force instantiation of any remaining CONSTANT_P_RTX nodes. * rtl.h (purge_builtin_constant_p): Prototype here. * toplev.c (rest_of_compilation): Invoke purge_builtin_constant_p pass after GCSE and before loop. (flag_gcse): No longer static. * flags.h (flag_gcse): Prototype here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61642 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 1a4ca2e7765..8f9ac33cc25 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -1,6 +1,6 @@
/* Common subexpression elimination for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC.
@@ -4332,9 +4332,14 @@ fold_rtx (x, insn)
break;
case 'x':
- /* Always eliminate CONSTANT_P_RTX at this stage. */
+ /* Eliminate CONSTANT_P_RTX if its constant. */
if (code == CONSTANT_P_RTX)
- return (const_arg0 ? const1_rtx : const0_rtx);
+ {
+ if (const_arg0)
+ return const1_rtx;
+ if (!flag_gcse)
+ return const0_rtx;
+ }
break;
}