[cost] Keep excluding unqualified variables by ItvUpdatedBy

Summary:
This diff avoids unqualified variables by `ItvUpdatedBy` are qualified later.  For example,

```
z = x & y;
z = z + 1;
```

While `z` should not be selected as a control variable, it wasn't, because it was qualified by the addition. This pattern introduces FPs in many cases.

Reviewed By: ngorogiannis

Differential Revision: D18505894

fbshipit-source-id: 13aec3008
master
Sungkeun Cho 5 years ago committed by Facebook Github Bot
parent 2b53fe543f
commit c3186578d6

@ -269,7 +269,9 @@ module Val = struct
of_itv (Itv.set_lb_zero (Itv.of_int max_char))
let set_itv_updated_by itv_updated_by x = {x with itv_updated_by}
let set_itv_updated_by itv_updated_by x =
{x with itv_updated_by= ItvUpdatedBy.join x.itv_updated_by itv_updated_by}
let set_itv_updated_by_addition = set_itv_updated_by ItvUpdatedBy.Addition

@ -36,7 +36,7 @@ class IntTest {
}
}
void control_var_band_add_constant_FP(int x, int y) {
void control_var_band_add_constant(int x, int y) {
int z;
for (int i = 0; i < 10; i++) {
if (unknown_bool) {

@ -116,9 +116,8 @@ codetoanalyze/java/performance/Cost_test_deps.java, codetoanalyze.java.performan
codetoanalyze/java/performance/Cost_test_deps.java, codetoanalyze.java.performance.Cost_test_deps.two_loops():int, 7, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 545, O(1), degree = 0]
codetoanalyze/java/performance/EvilCfg.java, EvilCfg.foo(int,int,boolean):void, 0, INFINITE_EXECUTION_TIME, no_bucket, ERROR, [Unbounded loop,Loop at line 15]
codetoanalyze/java/performance/FieldAccess.java, codetoanalyze.java.performance.FieldAccess.iterate_upto_field_size(codetoanalyze.java.performance.FieldAccess$Test):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 2 + 6 ⋅ test.a, O(test.a), degree = 1,{test.a},Loop at line 16]
codetoanalyze/java/performance/IntTest.java, IntTest.control_var_band_add_constant_FP(int,int):void, 0, INFINITE_EXECUTION_TIME, no_bucket, ERROR, [Unbounded loop,Loop at line 41]
codetoanalyze/java/performance/IntTest.java, IntTest.control_var_band_add_constant_FP(int,int):void, 4, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Parameter `x`,Binary operation: ([-oo, +oo] + 1):signed32]
codetoanalyze/java/performance/IntTest.java, IntTest.control_var_band_add_constant_FP(int,int):void, 6, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Parameter `x`,Binary operation: ([-oo, +oo] + 1):signed32]
codetoanalyze/java/performance/IntTest.java, IntTest.control_var_band_add_constant(int,int):void, 4, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Parameter `x`,Binary operation: ([-oo, +oo] + 1):signed32]
codetoanalyze/java/performance/IntTest.java, IntTest.control_var_band_add_constant(int,int):void, 6, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Parameter `x`,Binary operation: ([-oo, +oo] + 1):signed32]
codetoanalyze/java/performance/IntTest.java, IntTest.intValue_linear(java.lang.Integer):void, 1, EXPENSIVE_EXECUTION_TIME, no_bucket, ERROR, [with estimated cost 2 + 5 ⋅ mKBytesToSend + 3 ⋅ (1+max(0, mKBytesToSend)), O(mKBytesToSend), degree = 1,{1+max(0, mKBytesToSend)},Loop at line 9,{mKBytesToSend},Loop at line 9]
codetoanalyze/java/performance/IntTest.java, IntTest.static_Integer_top():void, 0, INFINITE_EXECUTION_TIME, no_bucket, ERROR, [Unbounded loop,Loop at line 15]
codetoanalyze/java/performance/IntTest.java, IntTest.static_Integer_top():void, 1, INTEGER_OVERFLOW_L5, no_bucket, ERROR, [<LHS trace>,Assignment,Binary operation: ([0, +oo] + 1):signed32]

Loading…
Cancel
Save