aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-07-16 13:26:20 +0200
committerRichard Biener <rguenther@suse.de>2021-07-19 09:15:18 +0200
commit3ce20b6be543824a07c3367253188d754b58667e (patch)
tree62caf65c46628be85e43d4a5eb401ecd21c02459 /gcc/tree-ssa-sccvn.c
parent4a21a8c34a707e88f450375e3c7d593be75162f4 (diff)
downloadgcc-3ce20b6be543824a07c3367253188d754b58667e.zip
gcc-3ce20b6be543824a07c3367253188d754b58667e.tar.gz
gcc-3ce20b6be543824a07c3367253188d754b58667e.tar.bz2
Remove last gimple_expr_type uses
This removes the last uses of gimple_expr_type. 2021-07-16 Richard Biener <rguenther@suse.de> * tree-ssa-sccvn.c (vn_reference_eq): Handle NULL vr->type. (ao_ref_init_from_vn_reference): Likewise. (fully_constant_reference): Likewise. (vn_reference_lookup_call): Do not set vr->type to random values. * tree-ssa-pre.c (compute_avail): Do not try to PRE calls without a value. * tree-vect-generic.c (expand_vector_piecewise): Pass in whether we expanded parallel. (expand_vector_parallel): Adjust. (expand_vector_addition): Likewise. (expand_vector_comparison): Likewise. (expand_vector_operation): Likewise. (expand_vector_scalar_condition): Likewise. (expand_vector_conversion): Likewise.
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 7900df9..a174c31 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -764,14 +764,18 @@ vn_reference_eq (const_vn_reference_t const vr1, const_vn_reference_t const vr2)
if (vr1->operands == vr2->operands)
return true;
- if (COMPLETE_TYPE_P (vr1->type) != COMPLETE_TYPE_P (vr2->type)
- || (COMPLETE_TYPE_P (vr1->type)
- && !expressions_equal_p (TYPE_SIZE (vr1->type),
- TYPE_SIZE (vr2->type))))
+ if (!vr1->type || !vr2->type)
+ {
+ if (vr1->type != vr2->type)
+ return false;
+ }
+ else if (COMPLETE_TYPE_P (vr1->type) != COMPLETE_TYPE_P (vr2->type)
+ || (COMPLETE_TYPE_P (vr1->type)
+ && !expressions_equal_p (TYPE_SIZE (vr1->type),
+ TYPE_SIZE (vr2->type))))
return false;
-
- if (INTEGRAL_TYPE_P (vr1->type)
- && INTEGRAL_TYPE_P (vr2->type))
+ else if (INTEGRAL_TYPE_P (vr1->type)
+ && INTEGRAL_TYPE_P (vr2->type))
{
if (TYPE_PRECISION (vr1->type) != TYPE_PRECISION (vr2->type))
return false;
@@ -1049,6 +1053,10 @@ ao_ref_init_from_vn_reference (ao_ref *ref,
poly_offset_int size = -1;
tree size_tree = NULL_TREE;
+ /* We don't handle calls. */
+ if (!type)
+ return false;
+
machine_mode mode = TYPE_MODE (type);
if (mode == BLKmode)
size_tree = TYPE_SIZE (type);
@@ -1478,6 +1486,7 @@ fully_constant_vn_reference_p (vn_reference_t ref)
/* Simplify reads from constants or constant initializers. */
else if (BITS_PER_UNIT == 8
+ && ref->type
&& COMPLETE_TYPE_P (ref->type)
&& is_gimple_reg_type (ref->type))
{
@@ -3671,7 +3680,10 @@ vn_reference_lookup_call (gcall *call, vn_reference_t *vnresult,
vr->vuse = vuse ? SSA_VAL (vuse) : NULL_TREE;
vr->operands = valueize_shared_reference_ops_from_call (call);
- vr->type = gimple_expr_type (call);
+ tree lhs = gimple_call_lhs (call);
+ /* For non-SSA return values the referece ops contain the LHS. */
+ vr->type = ((lhs && TREE_CODE (lhs) == SSA_NAME)
+ ? TREE_TYPE (lhs) : NULL_TREE);
vr->punned = false;
vr->set = 0;
vr->base_set = 0;