[cfe-dev] [analyzer] Extend constraint manager to be able to compare simple SymSymExprs

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Tue Apr 7 10:35:45 PDT 2020


These layers never made much sense to me. We only really need two: 
`ConstraintManager` as the abstract base class and 
`RangeConstraintManager` as the particular implementation that we use. 
If you destroy the two intermediate layers i wouldn't mind.

On the other hand, our constraint manager is very much pushed to its 
limits where it is almost impossible to reason about the correctness and 
algorithmic complexity of the code we're writing. We should really do 
something about this whole technical debt thing and come up with a 
better structure for our implementation before landing more large 
features. Everybody keeps saying "oh but it's just a tiny feature and 
it'll immediately make my use case better" but after a few dozen 
iterations it ends up being a mess that's almost impossible to debug 
when it causes a sudden performance drop.

On 4/7/20 6:48 PM, Balázs Benics via cfe-dev wrote:
> The constraint manager has limited functionality in comparing symbols 
> to symbols.
> Though, it wouldn't be too hard to make it a bit smarter.
>
> I would like to implement the following logic in the constraint 
> manager class hierarchy:
> Given `a` and `b` well-constrained symbols.
> We should know that `a` less than `b` if the possible maximum value of 
> `a` is still less than the minimum value of `b`.
> In other words: `maxOf(a) < minOf(b)  =>  a < b`
>
> AFAIK `RangedConstraintManager` provides the interface to compare 
> symbols to constants.
> The `RangeConstraintManager` class only implements that interface.
>
> Should I extend the `RangedConstraintManager` interface to be able to 
> compare symbols to symbols?
> Or, I could create another interface layer on top of 
> `RangedConstraintManager` interface to provide the necessary functions.
>
> Which approach should I prefer?
>
> Balazs
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list