-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[aeneas] Preserve variable names (#3560)
In #3514, the LLBC does not keep the variable names from the Rust source. This PR extracts the names of variables from MIR and carries it over to the LLBC. For instance, for `tests/expected/llbc/basic1` which has the following Rust: ```rust fn select(s: bool, x: i32, y: i32) -> i32 { if s { x } else { y } } ``` without this PR, running Aeneas on the output LLBC produces: ```lean def select (b : Bool) (i : I32) (i1 : I32) : Result I32 := if b then Result.ok i else Result.ok i1 ``` but with this PR, it produces: ```lean def select (s : Bool) (x : I32) (y : I32) : Result I32 := if s then Result.ok x else Result.ok y ``` This should not be merged before #3514, so keeping it as a draft for the time being. The actual diff on top of #3514 can be viewed here: zhassan-aws/kani@llbc4...zhassan-aws:kani:llbc-names By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
- Loading branch information
1 parent
0e03c1c
commit ab39455
Showing
3 changed files
with
29 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
fn test::is_zero(@1: i32) -> bool\ | ||
{\ | ||
let @0: bool; // return\ | ||
let @1: i32; // arg #1\ | ||
let i@1: i32; // arg #1\ | ||
|
||
@0 := copy (@1) == const (0 : i32)\ | ||
@0 := copy (i@1) == const (0 : i32)\ | ||
return\ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
fn test::select(@1: bool, @2: i32, @3: i32) -> i32 | ||
{ | ||
let @0: i32; // return | ||
let @1: bool; // arg #1 | ||
let @2: i32; // arg #2 | ||
let @3: i32; // arg #3 | ||
let s@1: bool; // arg #1 | ||
let x@2: i32; // arg #2 | ||
let y@3: i32; // arg #3 | ||
|
||
if copy (@1) { | ||
@0 := copy (@2) | ||
if copy (s@1) { | ||
@0 := copy (x@2) | ||
} | ||
else { | ||
@0 := copy (@3) | ||
@0 := copy (y@3) | ||
} | ||
return | ||
} |