Skip to content

Commit 20908b2

Browse files
committed
GOTO conversion: create temporaries with minimal scope
GOTO conversion introduces temporaries when cleaning expression, e.g., removing side effects. We previously considered them to have block scope as they only were marked dead when the block containing them was left. This, however, can be a much larger range of instructions than for what instructions they actually need to be live for. As a consequence, GOTO conversion frequently deemed it necessary to introduce declaration hops for we had goto instructions that would jump over the declaration of the temporary, but still within the block that contained that temporary (and well after the last actual use of that temporary). This PR now largely (with the exception of compound literals, which yield temporaries that must have block scope) removes the side effect that creating temporaries had on scope tracking. Instead, methods explicitly return the list of temporaries in need of cleanup. This avoids performance penalties seen when trying to upgrade Kani to CBMC version 6. Kani makes extensive use of statement expressions, which are one case of instructions that yield a temporary that needs to be cleaned up as soon as possible.
1 parent 66ae03f commit 20908b2

File tree

57 files changed

+483
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+483
-224
lines changed

regression/cbmc-cover/location14/test.desc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ main.c
66
^\[main.coverage.1\] file main.c line 8 function main block 1.*: SATISFIED$
77
^\[main.coverage.2\] file main.c line 12 function main block 2.*: FAILED$
88
^\[main.coverage.3\] file main.c line 12 function main block 3.*: FAILED$
9-
^\[main.coverage.4\] file main.c line 13 function main block 4.*: SATISFIED$
9+
^\[main.coverage.4\] file main.c line 12 function main block 4.*: FAILED$
10+
^\[main.coverage.5\] file main.c line 13 function main block 5.*: SATISFIED$
1011
^\[foo.coverage.1\] file main.c line 3 function foo block 1.*: FAILED$
11-
^\*\* 2 of 5 covered \(40.0%\)
12+
^\*\* 2 of 6 covered \(33.3%\)
1213
--
1314
^warning: ignoring

regression/cprover/safety/use_after_free1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ use_after_free1.c
44
^EXIT=0$
55
^SIGNAL=0$
66
^\(\d+\) ∀ ς : state . S11\(ς\) ⇒ S12\(ς\[❝main::\$tmp::return_value_malloc❞:=allocate\(ς, 4\)\]\)$
7-
^\(\d+\) ∀ ς : state . S15\(ς\) ⇒ S16\(deallocate_state\(ς, cast\(ς\(❝main::1::p❞\), empty\*\)\)\)$
7+
^\(\d+\) ∀ ς : state . S16\(ς\) ⇒ S17\(deallocate_state\(ς, cast\(ς\(❝main::1::p❞\), empty\*\)\)\)$
88
--

regression/goto-analyzer/branching-ge/test-always-constants.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-always.c
33
--no-standard-checks --variable-sensitivity --vsd-values constants --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* TOP @ \[17, 19\]
7-
^main::1::p .* TOP @ \[3, 8, 14\]
6+
^main::1::i .* TOP @ \[23, 25\]
7+
^main::1::p .* TOP @ \[3, 9, 18\]
88
--

regression/goto-analyzer/branching-ge/test-always-intervals.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-always.c
33
--no-standard-checks --variable-sensitivity --vsd-values intervals --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* \[5, 5\] @ \[17\]
7-
^main::1::p .* \[0, A\] @ \[3, 8, 14\]
6+
^main::1::i .* \[5, 5\] @ \[23\]
7+
^main::1::p .* \[0, A\] @ \[3, 9, 18\]
88
--

regression/goto-analyzer/branching-ge/test-always-value-set.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-always.c
33
--no-standard-checks --variable-sensitivity --vsd-values set-of-constants --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* value-set-begin: 5 :value-set-end @ \[17\]
7-
^main::1::p .* value-set-begin: 0, 5, 10 :value-set-end @ \[3, 8, 14\]
6+
^main::1::i .* value-set-begin: 5 :value-set-end @ \[23\]
7+
^main::1::p .* value-set-begin: 0, 5, 10 :value-set-end @ \[3, 9, 18\]
88
--

regression/goto-analyzer/branching-ge/test-indeterminate-constants.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-indeterminate.c
33
--no-standard-checks --variable-sensitivity --vsd-values constants --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* TOP @ \[17, 19\]
7-
^main::1::p .* TOP @ \[3, 8, 14\]
6+
^main::1::i .* TOP @ \[23, 25\]
7+
^main::1::p .* TOP @ \[3, 9, 18\]
88
--

regression/goto-analyzer/branching-ge/test-indeterminate-intervals.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-indeterminate.c
33
--no-standard-checks --variable-sensitivity --vsd-values intervals --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* \[FFFFFFFB, 5\] @ \[17, 19\]
7-
^main::1::p .* \[0, A\] @ \[3, 8, 14\]
6+
^main::1::i .* \[FFFFFFFB, 5\] @ \[23, 25\]
7+
^main::1::p .* \[0, A\] @ \[3, 9, 18\]
88
--

regression/goto-analyzer/branching-ge/test-indeterminate-value-set.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-indeterminate.c
33
--no-standard-checks --variable-sensitivity --vsd-values set-of-constants --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* value-set-begin: 5, -5 :value-set-end @ \[17, 19\]
7-
^main::1::p .* value-set-begin: 0, 5, 10 :value-set-end @ \[3, 8, 14\]
6+
^main::1::i .* value-set-begin: 5, -5 :value-set-end @ \[23, 25\]
7+
^main::1::p .* value-set-begin: 0, 5, 10 :value-set-end @ \[3, 9, 18\]
88
--

regression/goto-analyzer/branching-ge/test-never-constants.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-never.c
33
--no-standard-checks --variable-sensitivity --vsd-values constants --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* TOP @ \[17, 19\]
7-
^main::1::p .* TOP @ \[3, 8, 14\]
6+
^main::1::i .* TOP @ \[23, 25\]
7+
^main::1::p .* TOP @ \[3, 9, 18\]
88
--

regression/goto-analyzer/branching-ge/test-never-intervals.desc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ main-never.c
33
--no-standard-checks --variable-sensitivity --vsd-values intervals --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
^main::1::i .* \[FFFFFFFB, FFFFFFFB\] @ \[19\]
7-
^main::1::p .* \[0, A\] @ \[3, 8, 14\]
6+
^main::1::i .* \[FFFFFFFB, FFFFFFFB\] @ \[25\]
7+
^main::1::p .* \[0, A\] @ \[3, 9, 18\]
88
--

0 commit comments

Comments
 (0)