Skip to content

Commit ffb9246

Browse files
author
martin
committed
Move --constant-propagator to goto-analyzer
The functionality is already present and tested so there is not much to do.
1 parent 480260a commit ffb9246

File tree

12 files changed

+32
-34
lines changed

12 files changed

+32
-34
lines changed

regression/goto-instrument/constant-propagation-function-call/main.c renamed to regression/goto-analyzer/constant-propagation-function-call/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ int main()
1313
int b;
1414
b = nondet();
1515
a = f(a);
16+
assert(a == 4);
1617
assert(!(0 <= a && a < 5 && 0 <= b && b < 5));
1718
}

regression/goto-instrument/constant-propagation-function-call/test.desc renamed to regression/goto-analyzer/constant-propagation-function-call/test.desc

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
CORE
22
main.c
3-
--constant-propagator
4-
^EXIT=10$
3+
--verify --constants
4+
^EXIT=0$
55
^SIGNAL=0$
6-
Removing returns
7-
VERIFICATION FAILED
8-
ASSIGN main\:\:1\:\:a \:\= 4
9-
ASSERT ¬\(main::1::b ≥ 0\) ∨ main::1::b ≥ 5
6+
\[main.assertion.1\] line 16 assertion a == 4: SUCCESS
7+
\[main.assertion.2\] line 17 assertion !\(0 <= a && a < 5 && 0 <= b && b < 5\): UNKNOWN
108
--
119
^warning: ignoring
12-
ASSERT true
1310
--
1411
This tests that constants are propagated through function calls, correctly
1512
taking into account the return value. Constant propagation should result in
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--verify --constants --recursive-interprocedural --loop-unwind 4 --one-domain-per-history
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main.assertion.1\] line 17 assertion i \!= n: UNKNOWN
7+
--
8+
^warning: ignoring
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--verify --constants
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main.assertion.1\] line 7 assertion \*p == 0: SUCCESS
7+
--
8+
^warning: ignoring

regression/goto-instrument/constant_propagator_unreachable/test.desc renamed to regression/goto-analyzer/constant_propagator_unreachable/test.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
CORE
22
test.c
3-
--constant-propagator
3+
--verify --constants
44
^EXIT=0$
55
^SIGNAL=0$
6-
VERIFICATION SUCCESSFUL
6+
SUCCESS \(unreachable\)
77
--
88
failed to find state
99
--

regression/goto-instrument/constant-propagation1/test.desc

Lines changed: 0 additions & 8 deletions
This file was deleted.

regression/goto-instrument/constant-propagation2/test.desc

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/goto-instrument/goto_instrument_parse_options.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,13 +1270,13 @@ void goto_instrument_parse_optionst::instrument_goto_program()
12701270

12711271
if(cmdline.isset("constant-propagator"))
12721272
{
1273-
do_indirect_call_and_rtti_removal();
1274-
do_remove_returns();
1275-
1276-
log.status() << "Propagating Constants" << messaget::eom;
1277-
1278-
constant_propagator_ait constant_propagator_ai(goto_model);
1279-
remove_skip(goto_model);
1273+
log.status() << "--constant-propagator is deprecated, "
1274+
<< "'goto-analyzer --simplify out.gb "
1275+
<< "--vsd --vsd-value constants'"
1276+
<< " is the recommended replacement but "
1277+
<< "'goto-analyzer --simplify out.gb --constants'"
1278+
<< " should provide backwards compatability"
1279+
<< messaget::eom;
12801280
}
12811281

12821282
if(cmdline.isset("generate-function-body"))
@@ -1841,7 +1841,6 @@ void goto_instrument_parse_optionst::help()
18411841
" single edge back to the loop head\n"
18421842
" --drop-unused-functions drop functions trivially unreachable from main function\n" // NOLINT(*)
18431843
HELP_REMOVE_POINTERS
1844-
" --constant-propagator propagate constants and simplify expressions\n" // NOLINT(*)
18451844
" --inline perform full inlining\n"
18461845
" --partial-inline perform partial inlining\n"
18471846
" --function-inline <function> transitively inline all calls <function> makes\n" // NOLINT(*)

src/goto-instrument/goto_instrument_parse_options.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Author: Daniel Kroening, [email protected]
4747
// clang-format off
4848
// Options that have been moved to goto-analyzer
4949
#define GOTO_INSTRUMENT_MIGRATED_OPTIONS \
50+
"(constant-propagator)" \
5051
"(show-dependence-graph)" \
5152
"(show-intervals)" \
5253
// empty last line
@@ -94,7 +95,7 @@ Author: Daniel Kroening, [email protected]
9495
OPT_TIMESTAMP \
9596
"(show-natural-loops)(show-lexical-loops)(accelerate)(havoc-loops)" \
9697
"(verbosity):(version)(xml-ui)(json-ui)" \
97-
"(accelerate)(constant-propagator)" \
98+
"(accelerate)" \
9899
"(k-induction):(step-case)(base-case)" \
99100
"(show-call-sequences)(check-call-sequence)" \
100101
"(interpreter)(show-reaching-definitions)" \

0 commit comments

Comments
 (0)