From 2c3860b8f6e9ba3e0878ecadfdef409da0f471b7 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Thu, 2 Nov 2023 19:32:32 +0100 Subject: [analysis] Allow joining a single vector element efficiently (#6071) Previously, modifying a single vector element of a `Shared` element required materializing a full vector to do the join. When there is just a single element to update, materializing all the other elements with bottom value is useless work. Add a `Vector::SingletonElement` utility that represents but does not materialize a vector with a single non-bottom element and allow it to be passed to `Vector::join`. Also update `Shared` and `Inverted` so that `SingletonElement` joins still work on vectors wrapped in those other lattices. --- src/analysis/lattices/shared.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/analysis/lattices/shared.h') diff --git a/src/analysis/lattices/shared.h b/src/analysis/lattices/shared.h index 489ed0003..e75b895ea 100644 --- a/src/analysis/lattices/shared.h +++ b/src/analysis/lattices/shared.h @@ -106,7 +106,8 @@ template struct Shared { return false; } - bool join(Element& joinee, const typename L::Element& joiner) const noexcept { + template + bool join(Element& joinee, const Elem& joiner) const noexcept { if (lattice.join(val, joiner)) { // We have moved to the next value in our ascending chain. Assign it a new // sequence number and update joinee with that sequence number. -- cgit v1.2.3