summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-ccp.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-16 11:36:30 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-16 11:36:30 +0000
commitc701e5d534f0545c870353637d565cca5dc19cbe (patch)
tree8f1870e0ed7b128c09f885498dd35f51103bff22 /gcc/tree-ssa-ccp.c
parente55c858550770fbcd8b9cb202615d546552310e3 (diff)
downloadgcc-c701e5d534f0545c870353637d565cca5dc19cbe.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171043 138bc75d-0d04-0410-961f-82ee72b054a4
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 8b8d996f508..4fc4316bb1c 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)
{