aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-fold.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-07-19 14:16:54 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-07-19 14:16:54 +0000
commit13e889530d0da219afcbcd78c768688593dd5257 (patch)
tree30e3412617c2b0809920e06ce7f81591d03f4515 /gcc/gimple-fold.c
parent1caf0482104f4b8a3ea0109ae95dd19cf39c52a2 (diff)
downloadgcc-13e889530d0da219afcbcd78c768688593dd5257.zip
gcc-13e889530d0da219afcbcd78c768688593dd5257.tar.gz
gcc-13e889530d0da219afcbcd78c768688593dd5257.tar.bz2
gimple-fold.c (get_base_constructor): Add VIEW_CONVERT case, handle all tcc_constant bases and valueize SSA names.
2016-07-19 Richard Biener <rguenther@suse.de> * gimple-fold.c (get_base_constructor): Add VIEW_CONVERT case, handle all tcc_constant bases and valueize SSA names. * tree-ssa-sccvn.c (fully_constant_vn_reference_p): Handle tcc_constant bases. * c-c++-common/vector-subscript-6.c: New testcase. * c-c++-common/vector-subscript-7.c: Likewise. From-SVN: r238475
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r--gcc/gimple-fold.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index cbfcc2f..3a50088 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -5508,6 +5508,9 @@ get_base_constructor (tree base, HOST_WIDE_INT *bit_offset,
return NULL_TREE;
base = TREE_OPERAND (base, 0);
}
+ else if (valueize
+ && TREE_CODE (base) == SSA_NAME)
+ base = valueize (base);
/* Get a CONSTRUCTOR. If BASE is a VAR_DECL, get its
DECL_INITIAL. If BASE is a nested reference into another
@@ -5529,6 +5532,10 @@ get_base_constructor (tree base, HOST_WIDE_INT *bit_offset,
return init;
}
+ case VIEW_CONVERT_EXPR:
+ return get_base_constructor (TREE_OPERAND (base, 0),
+ bit_offset, valueize);
+
case ARRAY_REF:
case COMPONENT_REF:
base = get_ref_base_and_extent (base, &bit_offset2, &size, &max_size,
@@ -5538,11 +5545,13 @@ get_base_constructor (tree base, HOST_WIDE_INT *bit_offset,
*bit_offset += bit_offset2;
return get_base_constructor (base, bit_offset, valueize);
- case STRING_CST:
case CONSTRUCTOR:
return base;
default:
+ if (CONSTANT_CLASS_P (base))
+ return base;
+
return NULL_TREE;
}
}