[PATCH] D99797: [analyzer] Handle intersections and adjacency in RangeSet::Factory::add function

Denys Petrov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 2 09:54:01 PDT 2021


ASDenysPetrov added a comment.

In D99797#2666358 <https://reviews.llvm.org/D99797#2666358>, @vsavchenko wrote:

> Thanks for working on improvements of the solver and constraints!  However, I have some tough questions about this patch.
>
> What I really want to understand here is motivation.  Why do we need to have `add` operation semantics like this in the first place?  My guess is that "the user" will be in the following patch.
> Additionally, I don't really like the idea of replacing something simple and fast (old `add` methods`) with something more complex unconditionally.  Old users still don't need this additional logic.  C++ has always been the language where we "pay for what we use".
> So, with good motivation, I'd still prefer methods like `add` and `addUnchecked` or smith similar.

My motivation is that I'm currently working on some bigger improvement (symbolic integral cast) and stucked here of the lack of handling intersections. Would you mind of accepting this revision in case if I restore complexity to O(N+M)?



================
Comment at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h:128
     ///
-    /// Complexity: O(N + M)
+    /// Complexity: O(N + Mlog(N))
     ///             where N = size(LHS), M = size(RHS)
----------------
vsavchenko wrote:
> This most certainly can be done in `O(N + M)` the same way the intersection is done.
Actually yes, it can. And it was, when I played with different solutions. But the code was poor readable. So I decided make it easier to understand to bring to review. Of couse I can move further to improve it and retain readability. I'll do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99797



More information about the cfe-commits mailing list