aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-07-12 10:33:52 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-07-12 10:33:52 +0000
commit72ab1c51b607dd5446ee24ff9fce9178d6b811cb (patch)
tree4ea043f18db4a77be52c825960e2554ac7d007f1 /gcc
parent49dbd6a0325f510af43b05bc0b91426779b4ed59 (diff)
downloadgcc-72ab1c51b607dd5446ee24ff9fce9178d6b811cb.zip
gcc-72ab1c51b607dd5446ee24ff9fce9178d6b811cb.tar.gz
gcc-72ab1c51b607dd5446ee24ff9fce9178d6b811cb.tar.bz2
Relax vector_builder::elt sanity check
I'd made it a precondition of vector_builder::elt that the encoding must have been fully populated and that all implicit elements are therefore defined. But for one of the AArch64 patches I'm working on, it'd be convenient to be able to look back at previous elements while building up the encoding. This patch therefore makes the assert specific to implicit elements only. 2019-07-12 Richard Sandiford <richard.sandiford@arm.com> gcc/ * vector-builder.h (vector_builder::elt): Allow already-supplied elements to be read back before building is complete. From-SVN: r273440
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/vector-builder.h7
2 files changed, 9 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7f01af3..43b5248 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-12 Richard Sandiford <richard.sandiford@arm.com>
+
+ * vector-builder.h (vector_builder::elt): Allow already-supplied
+ elements to be read back before building is complete.
+
2019-07-12 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/91136
diff --git a/gcc/vector-builder.h b/gcc/vector-builder.h
index 9f95b01..aac8a87 100644
--- a/gcc/vector-builder.h
+++ b/gcc/vector-builder.h
@@ -199,14 +199,15 @@ template<typename T, typename Derived>
T
vector_builder<T, Derived>::elt (unsigned int i) const
{
- /* This only makes sense if the encoding has been fully populated. */
- gcc_checking_assert (encoded_nelts () <= this->length ());
-
/* First handle elements that are already present in the underlying
vector, regardless of whether they're part of the encoding or not. */
if (i < this->length ())
return (*this)[i];
+ /* Extrapolation is only possible if the encoding has been fully
+ populated. */
+ gcc_checking_assert (encoded_nelts () <= this->length ());
+
/* Identify the pattern that contains element I and work out the index of
the last encoded element for that pattern. */
unsigned int pattern = i % m_npatterns;