Commit 78930e4b by Richard Sandiford Committed by Richard Sandiford

Add an empty constructor shortcut to build_vector_from_ctor

Empty vector constructors are equivalent to zero vectors.  If we handle
that case directly, we can support it for variable-length vectors and
can hopefully make things more efficient for fixed-length vectors.

This is needed by a later C++ patch.

2019-11-18  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree.c (build_vector_from_ctor): Directly return a zero vector for
	empty constructors.

From-SVN: r278413
parent cb77875a
2019-11-18 Richard Sandiford <richard.sandiford@arm.com> 2019-11-18 Richard Sandiford <richard.sandiford@arm.com>
* tree.c (build_vector_from_ctor): Directly return a zero vector for
empty constructors.
2019-11-18 Richard Sandiford <richard.sandiford@arm.com>
* cse.c (cse_insn): Delete no-op register moves too. * cse.c (cse_insn): Delete no-op register moves too.
* simplify-rtx.c (comparison_to_mask): Handle unsigned comparisons. * simplify-rtx.c (comparison_to_mask): Handle unsigned comparisons.
Take a second comparison to control the value for NE. Take a second comparison to control the value for NE.
...@@ -1858,6 +1858,9 @@ make_vector (unsigned log2_npatterns, ...@@ -1858,6 +1858,9 @@ make_vector (unsigned log2_npatterns,
tree tree
build_vector_from_ctor (tree type, vec<constructor_elt, va_gc> *v) build_vector_from_ctor (tree type, vec<constructor_elt, va_gc> *v)
{ {
if (vec_safe_length (v) == 0)
return build_zero_cst (type);
unsigned HOST_WIDE_INT idx, nelts; unsigned HOST_WIDE_INT idx, nelts;
tree value; tree value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment