aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-06-25 08:41:14 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-06-25 08:41:14 +0000
commitee1f1270454962e90a8f76765ca77fd23134657a (patch)
treeaa6ec98a15b381a6e6704ef0dc90dbeea8696b35 /gcc/fold-const.c
parent423addc532f23bf1a9fe9900d0d13e0197d96496 (diff)
downloadgcc-ee1f1270454962e90a8f76765ca77fd23134657a.zip
gcc-ee1f1270454962e90a8f76765ca77fd23134657a.tar.gz
gcc-ee1f1270454962e90a8f76765ca77fd23134657a.tar.bz2
re PR tree-optimization/35518 (FAIL: gcc.c-torture/execute/20040709-1.c execution at -O2 and above)
2008-06-25 Richard Guenther <rguenther@suse.de> PR tree-optimization/35518 * fold-const.c (fold_ternary): Strip trivial BIT_FIELD_REFs. * tree-sra.c (instantiate_element): Use fold_build3 to build BIT_FIELD_REFs. (try_instantiate_multiple_fields): Likewise. From-SVN: r137100
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index aaae9d6..fc72b9b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -13117,6 +13117,13 @@ fold_ternary (enum tree_code code, tree type, tree op0, tree op1, tree op2)
return fold_convert (type, integer_zero_node);
}
}
+
+ /* A bit-field-ref that referenced the full argument can be stripped. */
+ if (INTEGRAL_TYPE_P (TREE_TYPE (arg0))
+ && TYPE_PRECISION (TREE_TYPE (arg0)) == tree_low_cst (arg1, 1)
+ && integer_zerop (op2))
+ return fold_convert (type, arg0);
+
return NULL_TREE;
default: