aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-03-16 11:36:30 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-03-16 11:36:30 +0000
commitf0eddb90199eac4df644329c8cd0089b110062f1 (patch)
tree8f1870e0ed7b128c09f885498dd35f51103bff22 /gcc/tree-ssa-ccp.c
parent29f10e717837d30e181b25f9a691c7457be120a5 (diff)
downloadgcc-f0eddb90199eac4df644329c8cd0089b110062f1.zip
gcc-f0eddb90199eac4df644329c8cd0089b110062f1.tar.gz
gcc-f0eddb90199eac4df644329c8cd0089b110062f1.tar.bz2
gimple-fold.c (maybe_fold_reference): Open-code relevant constant folding.
2011-03-16 Richard Guenther <rguenther@suse.de> * gimple-fold.c (maybe_fold_reference): Open-code relevant constant folding. Move MEM_REF canonicalization first. Rely on fold_const_aggregate_ref for initializer folding. * tree-ssa-ccp.c (ccp_fold): Handle constant vector extracts. * gcc.dg/tree-ssa/pr14814.c: Adjust. * gcc.dg/tree-ssa/ssa-ccp-19.c: Likewise. From-SVN: r171043
Diffstat (limited to 'gcc/tree-ssa-ccp.c')
-rw-r--r--gcc/tree-ssa-ccp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 8b8d996..4fc4316 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -1182,6 +1182,17 @@ ccp_fold (gimple stmt)
TREE_CODE (rhs),
TREE_TYPE (rhs), val);
}
+ else if (TREE_CODE (rhs) == BIT_FIELD_REF
+ && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
+ {
+ tree val = get_constant_value (TREE_OPERAND (rhs, 0));
+ if (val)
+ return fold_ternary_loc (EXPR_LOCATION (rhs),
+ TREE_CODE (rhs),
+ TREE_TYPE (rhs), val,
+ TREE_OPERAND (rhs, 1),
+ TREE_OPERAND (rhs, 2));
+ }
else if (TREE_CODE (rhs) == MEM_REF
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
{