diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-06-09 22:05:49 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-06-09 22:05:49 +0000 |
commit | 7ebc607f2b271bf8543b479111fb412eb8003d1a (patch) | |
tree | 9f0f1d2cdf1394505c0c9e20d41471dcd5c8f5d1 /gcc/fold-const.c | |
parent | ff51038d05ba313d8e2cbf4143427fe71fb15ca3 (diff) | |
download | gcc-7ebc607f2b271bf8543b479111fb412eb8003d1a.tar.gz |
* fold-const.c (fold): Even with otherwise constant trees, look for
opportunities to combine integer constants.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20392 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 5daa253a449..18e83852d1b 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4433,9 +4433,12 @@ fold (expr) return convert (TREE_TYPE (t), con); /* If ARG0 is a constant, don't change things around; - instead keep all the constant computations together. */ + instead keep all the constant computations together. + Notice, however, if we can merge integer constants. */ - if (TREE_CONSTANT (arg0)) + if (TREE_CONSTANT (arg0) + && !(TREE_CODE (con) == INTEGER_CST + && TREE_CODE (arg1) == INTEGER_CST)) return t; /* Otherwise return (CON +- ARG1) - VAR. */ @@ -4450,9 +4453,12 @@ fold (expr) return convert (TREE_TYPE (t), con); /* If ARG0 is a constant, don't change things around; - instead keep all the constant computations together. */ + instead keep all the constant computations together. + Notice, however, if we can merge integer constants. */ - if (TREE_CONSTANT (arg0)) + if (TREE_CONSTANT (arg0) + && !(TREE_CODE (con) == INTEGER_CST + && TREE_CODE (arg1) == INTEGER_CST)) return t; /* Otherwise return VAR +- (ARG1 +- CON). */ @@ -4481,7 +4487,13 @@ fold (expr) if (split_tree (arg1, code, &var, &con, &varsign)) { - if (TREE_CONSTANT (arg1)) + /* If ARG1 is a constant, don't change things around; + instead keep all the constant computations together. + Notice, however, if we can merge integer constants. */ + + if (TREE_CONSTANT (arg1) + && !(TREE_CODE (con) == INTEGER_CST + && TREE_CODE (arg0) == INTEGER_CST)) return t; if (varsign == -1) |