This introduces a uniqued, bump-pointer allocated pool of value lattice elements. ValueLatticeElement is still used directly for some temporaries, but the persisted values are fetched from the pool and represented as const ValueLatticeElement *.
I think this has a couple of advantages:
- This should use less memory, as each distinct value lattice element is only stored once.
- As a consequence, LVI no longer needs to store overdefined values separately, as storing everything directly is now cheap.
- SCCP will no longer have to worry about invalidating references to value lattice elements.
This patch only has the LVI portion of the change (and there's probably some optimization potential there). For SCCP the main extra thing to handle would be the NumRangeExtensions, which would have to be moved into a separate value->int map under this model.
Preliminary compile-time numbers are a small improvement: https://llvm-compile-time-tracker.com/compare.php?from=862db369f8a8c543735c475ed05cf512846c3868&to=4388725f333c69cf29724528405038f8e143e579&stat=instructions