From affced4303680372e1b751e70ad7a6abc09d58c0 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 13 Jun 2018 09:05:25 -0700 Subject: [PATCH] Cost: actually, we needed data dependency Reviewed By: ezgicicek Differential Revision: D8388507 fbshipit-source-id: 5a36f00 --- infer/tests/codetoanalyze/c/performance/issues.exp | 4 ++++ infer/tests/codetoanalyze/c/performance/loops.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/infer/tests/codetoanalyze/c/performance/issues.exp b/infer/tests/codetoanalyze/c/performance/issues.exp index 803101fab..6cff3a80a 100644 --- a/infer/tests/codetoanalyze/c/performance/issues.exp +++ b/infer/tests/codetoanalyze/c/performance/issues.exp @@ -93,6 +93,10 @@ codetoanalyze/c/performance/loops.c, if_in_loop, 13, EXPENSIVE_EXECUTION_TIME_CA codetoanalyze/c/performance/loops.c, if_out_loop, 7, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 508] codetoanalyze/c/performance/loops.c, if_out_loop, 8, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 508] codetoanalyze/c/performance/loops.c, if_out_loop, 11, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 513] +codetoanalyze/c/performance/loops.c, larger_state_FN, 3, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 1003] +codetoanalyze/c/performance/loops.c, larger_state_FN, 4, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 1003] +codetoanalyze/c/performance/loops.c, larger_state_FN, 5, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 1003] +codetoanalyze/c/performance/loops.c, larger_state_FN, 7, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 1003] codetoanalyze/c/performance/two_loops_symbolic.c, two_loops_symb, 3, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 4 + 6 * s$1] codetoanalyze/c/performance/two_loops_symbolic.c, two_loops_symb, 4, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 4 + 6 * s$1] codetoanalyze/c/performance/two_loops_symbolic.c, two_loops_symb, 6, EXPENSIVE_EXECUTION_TIME_CALL, no_bucket, ERROR, [with estimated cost 8 + 12 * s$1] diff --git a/infer/tests/codetoanalyze/c/performance/loops.c b/infer/tests/codetoanalyze/c/performance/loops.c index 0cf976fb5..0852776f5 100644 --- a/infer/tests/codetoanalyze/c/performance/loops.c +++ b/infer/tests/codetoanalyze/c/performance/loops.c @@ -35,3 +35,15 @@ int if_out_loop(int t) { } return p; } + +void larger_state_FN() { + + int i = 0, k = 0; + while (k < 100) { + i++; + if (i >= 10000) { + k++; + i = 0; + } + } +}