aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2006-06-16 08:34:39 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2006-06-16 08:34:39 +0000
commit47392a21de0f9488d598ecfb6aac3e6d45a7457a (patch)
treefd6d5ada60a7492a6e25efd81359ea4abfbeab56
parent55dea919b6f3a8a18d50644aa235680c07a7b153 (diff)
downloadgcc-47392a21de0f9488d598ecfb6aac3e6d45a7457a.zip
gcc-47392a21de0f9488d598ecfb6aac3e6d45a7457a.tar.gz
gcc-47392a21de0f9488d598ecfb6aac3e6d45a7457a.tar.bz2
fold-const.c (fold_truthop): Only return new tree node if we canonicalized something.
2006-06-16 Michael Matz <matz@suse.de> Richard Guenther <rguenther@suse.de> * fold-const.c (fold_truthop): Only return new tree node if we canonicalized something. Co-Authored-By: Richard Guenther <rguenther@suse.de> From-SVN: r114713
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/fold-const.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e600a4e..96ca893 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-16 Michael Matz <matz@suse.de>
+ Richard Guenther <rguenther@suse.de>
+
+ * fold-const.c (fold_truthop): Only return new tree node if
+ we canonicalized something.
+
2006-06-16 Richard Guenther <rguenther@suse.de>
* function.h (enum function_frequency): Move declaration
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 6522afd..4b49fa9 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4862,6 +4862,8 @@ fold_truthop (enum tree_code code, tree truth_type, tree lhs, tree rhs)
tree lntype, rntype, result;
int first_bit, end_bit;
int volatilep;
+ tree orig_lhs = lhs, orig_rhs = rhs;
+ enum tree_code orig_code = code;
/* Start by getting the comparison codes. Fail if anything is volatile.
If one operand is a BIT_AND_EXPR with the constant one, treat it as if
@@ -4955,7 +4957,11 @@ fold_truthop (enum tree_code code, tree truth_type, tree lhs, tree rhs)
build_int_cst (TREE_TYPE (ll_arg), 0));
if (LOGICAL_OP_NON_SHORT_CIRCUIT)
- return build2 (code, truth_type, lhs, rhs);
+ {
+ if (code != orig_code || lhs != orig_lhs || rhs != orig_rhs)
+ return build2 (code, truth_type, lhs, rhs);
+ return NULL_TREE;
+ }
}
/* See if the comparisons can be merged. Then get all the parameters for