[PATCH] D137848: [ConstraintElimination] Add Decomposition class (NFCI)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 13 14:43:50 PST 2022


fhahn accepted this revision.
fhahn added reviewers: fcloutier, zjaffal.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM, thanks! This is a nice improvement, we can iterate over making it a class as follow-up. It might be good to update title/description to say struct instead of class.



================
Comment at: llvm/lib/Transforms/Scalar/ConstraintElimination.cpp:196
+/// Represents an Offset + Coefficient1 * Variable1 + ... decomposition.
+struct Decomposition {
+  int64_t Offset = 0;
----------------
nikic wrote:
> fhahn wrote:
> > Could this be a `class` instead of a `struct` to ensure the offsets are only adjusted using the safe methods?
> What would we do with the code in `ConstraintInfo::getConstraint`, which actually uses the decomposition in that case? Read-only getters?
Yeah that would be an option, but there might be a better API. I can play around a bit once this lands as `struct`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137848/new/

https://reviews.llvm.org/D137848



More information about the llvm-commits mailing list