aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2004-09-07 22:59:18 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2004-09-07 20:59:18 +0000
commitec666d23ca0f507e0940bcdf0b65848bceb1af30 (patch)
tree4e9fa96fc33091fc673b10b40663ad44ba84f3aa /gcc/cse.c
parentc4817ba67ecd0e9c9ec8bb2771be05551f9ce195 (diff)
downloadgcc-ec666d23ca0f507e0940bcdf0b65848bceb1af30.zip
gcc-ec666d23ca0f507e0940bcdf0b65848bceb1af30.tar.gz
gcc-ec666d23ca0f507e0940bcdf0b65848bceb1af30.tar.bz2
cse.c (fold_rtx): Avoid building of (CONST (MINUS (CONST_INT) (SYMBOL_REF)))
* cse.c (fold_rtx): Avoid building of (CONST (MINUS (CONST_INT) (SYMBOL_REF))) From-SVN: r87156
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 7b540a6..fb96328 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3787,7 +3787,16 @@ fold_rtx (rtx x, rtx insn)
new = simplify_unary_operation (code, mode,
const_arg0 ? const_arg0 : folded_arg0,
mode_arg0);
- if (new != 0 && is_const)
+ /* NEG of PLUS could be converted into MINUS, but that causes
+ expressions of the form
+ (CONST (MINUS (CONST_INT) (SYMBOL_REF)))
+ which many ports mistakenly treat as LEGITIMATE_CONSTANT_P.
+ FIXME: those ports should be fixed. */
+ if (new != 0 && is_const
+ && GET_CODE (new) == PLUS
+ && (GET_CODE (XEXP (new, 0)) == SYMBOL_REF
+ || GET_CODE (XEXP (new, 0)) == LABEL_REF)
+ && GET_CODE (XEXP (new, 1)) == CONST_INT)
new = gen_rtx_CONST (mode, new);
}
break;