diff options
author | Roger Sayle <sayle@gcc.gnu.org> | 2004-03-23 14:26:43 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2004-03-23 14:26:43 +0000 |
commit | bb3a37acf0479f9d12c64852163b02cb63fef69e (patch) | |
tree | 5d31569a0dac072a9ef9e7c480f9f8ab8d3fe778 /gcc/fold-const.c | |
parent | f2c79f80f2c92c9fca4632598e019c09903075ca (diff) | |
download | gcc-bb3a37acf0479f9d12c64852163b02cb63fef69e.zip gcc-bb3a37acf0479f9d12c64852163b02cb63fef69e.tar.gz gcc-bb3a37acf0479f9d12c64852163b02cb63fef69e.tar.bz2 |
re PR rtl-optimization/14669 (Wrong code with -O for enum values expression E4 <= t && t <= E6)
2004-03-23 Kazu Hirata <kazu@cs.umass.edu>
PR optimization/14669
* fold-const.c (fold): Only unwiden integer comparisons for equality
or inequality operators, or when the signedness is the same.
* g++.dg/opt/fold2.C: New test case.
From-SVN: r79859
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 84c6055..ab43be8 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7535,6 +7535,9 @@ fold (tree expr) else if (TREE_CODE (TREE_TYPE (arg0)) == INTEGER_TYPE && TREE_CODE (arg0) == NOP_EXPR && (tem = get_unwidened (arg0, NULL_TREE)) != arg0 + && (code == EQ_EXPR || code == NE_EXPR + || TREE_UNSIGNED (TREE_TYPE (arg0)) + == TREE_UNSIGNED (TREE_TYPE (tem))) && (t1 = get_unwidened (arg1, TREE_TYPE (tem))) != 0 && (TREE_TYPE (t1) == TREE_TYPE (tem) || (TREE_CODE (t1) == INTEGER_CST |