Commit Graph

112 Commits

Author SHA1 Message Date
Simon Friis Vindum
5da73f3232 C++: Make sure that nrOfBoundsNEPhi is functional 2025-11-14 12:26:23 +01:00
Simon Friis Vindum
74b433ef59 C++: Add range analysis tests 2025-11-14 12:26:22 +01:00
Simon Friis Vindum
69e70d7cbc Reapply "Merge pull request #20645 from paldepind/cpp/range-analysis-measure"
This reverts commit e7c029ae7d.
2025-11-14 12:26:21 +01:00
Enrico Steffinlongo
e7c029ae7d Revert "Merge pull request #20645 from paldepind/cpp/range-analysis-measure"
This reverts commit a0a6f288b5, reversing
changes made to 32f21d6d49.
2025-11-07 16:49:47 +00:00
Simon Friis Vindum
3af9885489 C++: Fix typos in tests 2025-10-24 16:04:34 +02:00
Simon Friis Vindum
f207404b0d C++: Accept test changes 2025-10-21 16:03:12 +02:00
Simon Friis Vindum
c1f0f3da96 C++: Handle guard phi nodes differently 2025-10-16 15:05:46 +02:00
Simon Friis Vindum
99103a5741 C++: Add additional test for range analysis 2025-10-16 15:05:45 +02:00
Simon Friis Vindum
8896a7210b C++: Add number of bounds test to simple range analysis 2025-10-16 15:05:44 +02:00
Simon Friis Vindum
7eacd87343 C++: Apply widening based on number of bounds measure 2025-10-16 15:05:42 +02:00
Simon Friis Vindum
70a8c4f37f C++: Add range analysis examples that explode 2025-10-15 11:42:17 +02:00
Simon Friis Vindum
e9f2a8b017 C++: Extend nested ternary test with two more terms in the addition 2025-01-13 13:54:05 +01:00
Simon Friis Vindum
847f3f1fc2 C++: Add test for nested ternary expressions of literals 2025-01-13 12:08:50 +01:00
Erik Krogh Kristensen
d36c66cfca remove redundant inline casts in arguments where the type is inferred by the call target 2021-10-29 14:37:56 +02:00
Anders Fugmann
c9c41252e3 C++: Update test results in SimpleRangeAnalysis 2021-09-24 12:23:48 +02:00
Anders Fugmann
d7afd86a27 C++: Add test case exposing problem with overflows for upperBound predicate 2021-09-24 11:44:05 +02:00
Anders Fugmann
270dbd2bf7 C++: Revert peer review suggestion.
The suggested change has a severe impact on row counts, as cpp does not cache
the results for `bbDominates`. Since the `getGuardedUpperBound` predicate the
cost of runtime complexity is considered higher than the benefit of this change.
2021-09-09 13:26:42 +02:00
Anders Fugmann
6c44b0e6e7 C++: Add test case where a guarded block has two predecessors which are both in the dominance domain of the guard 2021-09-09 13:18:49 +02:00
Anders Fugmann
d962fc4ce1 C++: Improve predicate upperBound in SimpleRangeAnalysis
If an expression has an immediate guardPhi node, this is used as a strict upper bound
2021-09-02 21:46:18 +02:00
Anders Fugmann
c110508b4e C++: Add tests to expose potential improvements available to SimpleRangeAnalysis 2021-09-02 21:20:33 +02:00
Mathias Vorreiter Pedersen
39d9395bc3 C++: Fix off-by-one in range analysis for 'RemExpr'. 2021-07-16 16:35:19 +02:00
Mathias Vorreiter Pedersen
81aa115838 C++: Fix range analysis bug for 'RemExpr'. 2021-07-16 16:28:08 +02:00
Mathias Vorreiter Pedersen
dc2eea59a3 C++: Add buggy testcase with 'RemExpr'. 2021-07-16 16:27:09 +02:00
Jonas Jensen
0459248b9f Merge remote-tracking branch 'upstream/main' into SimpleRangeAnalysis-guard-overflow 2020-10-12 14:32:29 +02:00
Jonas Jensen
30b9d13a45 C++: Correct annotation in test 2020-10-12 11:25:38 +02:00
Jonas Jensen
9b12ceae8d C++: SimpleRangeAnalysis: widen recursive *, +, -
The number of candidate bounds during the main `SimpleRangeAnalysis`
recursion was in principle always exponential in the size of the
program, but in practice it did not get out of hand when only `+` and
`-` operations were supported. Now that `*` is also supported, the range
analysis started timing out on the SinaMostafanejad/OpenRDM project. The
problematic expressions in that project are of the form

    a*x*x*x + b*x*x + c*x + d

where most of the variables involved are recursive definitions and are
therefore likely to have a large number of candidate bounds.

The fix here is to identify those few binary operations that are most
likely to cause an explosion in the number of bounds and apply widening
to them. Previously, widening was only applied at definitions.
2020-10-12 11:09:01 +02:00
Jonas Jensen
bbeea452e1 C++: Add test with widening of binary Expr 2020-10-12 11:08:41 +02:00
Jonas Jensen
1d9acbfca9 C++: Demonstrate overflowing guard bounds 2020-10-06 15:31:34 +02:00
Jonas Jensen
ad11f76ec6 C++: Always normalize bounds after a computation
This stops some cases of `-0.0` from propagating through the range
analysis, fixing a false positive on arvidn/libtorrent.

There seems to be no need for a corresponding change in the caller of
`getDefLowerBoundsImpl` since that predicate only contains computations
that cannot introduce negative zero.
2020-09-11 11:59:00 +02:00
Jonas Jensen
911dec6f86 C++: SimpleRangeAnalysis (bool)x and !x support 2020-09-08 16:59:35 +02:00
Jonas Jensen
1b6da062cf C++: RangeAnalysis tests for bool conversions 2020-09-08 16:58:35 +02:00
Jonas Jensen
fbe42fb64c C++: Support != constant in range analysis 2020-09-04 09:20:23 +02:00
Jonas Jensen
d061b09fe0 C++: Test showing no support for != and ! 2020-09-04 09:02:42 +02:00
Jonas Jensen
023f2e97c1 C++: Really accept test results this time 2020-08-28 16:50:23 +02:00
Jonas Jensen
a25cc2d9c7 C++: Accept range-analysis test results 2020-08-28 14:54:44 +02:00
Jonas Jensen
027f22d8e7 C++: Test that range analysis ignores references 2020-08-28 14:41:57 +02:00
Jonas Jensen
b1c0e6f626 Merge remote-tracking branch 'upstream/main' into SimpleRangeAnalysis-mul-constant 2020-08-20 08:20:31 +02:00
Jonas Jensen
21d16d13fc Merge remote-tracking branch 'upstream/main' into SimpleRangeAnalysis-AssignMulExpr 2020-08-19 14:50:40 +02:00
Jonas Jensen
83884c0dc5 Merge pull request #4089 from jbj/jbj/printFloat-precise
C++: Accept float.toString changes in tests
2020-08-19 12:58:27 +02:00
Jonas Jensen
b316644ac2 C++: SimpleRangeAnalysis for *= by constant 2020-08-18 15:07:20 +02:00
Jonas Jensen
b6b72729f6 C++: SimpleRangeAnalysis for MulExpr by constant 2020-08-18 11:37:59 +02:00
Jonas Jensen
2e2f99cabf C++: Correctly classify the MulExpr rounding bugs 2020-08-18 10:39:57 +02:00
Jonas Jensen
e03fe81ce7 C++: Accept float.toString changes in tests 2020-08-17 15:07:00 +02:00
Jonas Jensen
fe72b559d3 C++: Range analysis for unsigned AssignMulExpr
This is essentially a copy-paste job of `AssignAddExpr`, together with
the math from the `UnsignedMulExpr` support.
2020-08-14 14:19:54 +02:00
Jonas Jensen
f90d779122 C++: Fix SimpleRangeAnalysis for AssignOperation
The range analysis wasn't producing useful bounds for `AssignOperation`s
(`+=`, `-=`) unless their RHS involved a variable. This is because a
shortcut was made in the `analyzableDef` predicate, which used to
specify that an analyzable definition was one for which we'd specified
the dependencies. But we can't distinguish between having _no
dependencies_ and having _no specification of the dependencies_.

The fix is to be more explicit about which definitions are analyzable.
To avoid too much repetition I'm still calling out to `analyzableExpr`
in the new code.
2020-08-14 14:15:58 +02:00
Jonas Jensen
93d8d8eb1d C++: Demonstrate range analysis MulExpr bugs
Unless these issues can be reproduced in far less contrived code, I
don't think they will cause problems in practice.
2020-08-12 12:10:23 +02:00
Jonas Jensen
1ee96a4b4f C++: SimpleRangeAnalysis: unsigned multiplication 2020-08-12 10:03:04 +02:00
Jonas Jensen
2ea25b9d90 C++: Precise printing of integer bounds
The pretty-printing of a QL `float` didn't include enough digits to tell
whether a large number had accurate bounds. The `toString` value of a
float appears to be more precise.
2020-08-11 16:48:01 +02:00
Mathias Vorreiter Pedersen
174b30461a C++: Fix syntax error in testfile 2020-07-14 19:47:21 +02:00
Mathias Vorreiter Pedersen
834ad92453 C++: Add test cases for unsigned multiplication and fix missing return value in existing tests 2020-07-14 16:57:47 +02:00