Skip to content

Commit b6cbb56

Browse files
committed
fix(kmir): consume noop call operands explicitly
1 parent 4950a56 commit b6cbb56

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

kmir/src/kmir/kdist/mir-semantics/kmir.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ where the returned result should go.
371371
rule isNoOpFunction(_) => false [owise]
372372
373373
syntax KItem ::= #consumeNoOpArgs(Operands, MaybeBasicBlockIdx)
374-
| #consumeNoOpArg(Operand) [strict(1)]
374+
| #consumeNoOpArg(Operand)
375375
376376
// SMIR marks some semantically empty shims (e.g. drop glue for trivially droppable slices)
377377
// as NoOpSym. They have no body and should continue immediately without switching frames,
@@ -388,7 +388,24 @@ where the returned result should go.
388388
...
389389
</k>
390390
391-
rule <k> #consumeNoOpArg(_:Value) => .K ... </k>
391+
rule <k> #consumeNoOpArg(operandConstant(_)) => .K ... </k>
392+
393+
rule <k> #consumeNoOpArg(operandValue(_)) => .K ... </k>
394+
395+
rule <k> #consumeNoOpArg(operandCopy(place(local(I), .ProjectionElems))) => .K ... </k>
396+
<stack> ListItem(StackFrame(_, _, _, _, CALLERLOCALS)) _:List </stack>
397+
requires 0 <=Int I
398+
andBool I <Int size(CALLERLOCALS)
399+
andBool isTypedValue(CALLERLOCALS[I])
400+
[preserves-definedness]
401+
402+
rule <k> #consumeNoOpArg(operandMove(place(local(I), _))) => .K ... </k>
403+
<stack> (ListItem(StackFrame(_, _, _, _, CALLERLOCALS) #as CALLERFRAME => #updateStackLocal(CALLERFRAME, I, Moved))) _:List
404+
</stack>
405+
requires 0 <=Int I
406+
andBool I <Int size(CALLERLOCALS)
407+
andBool isTypedValue(CALLERLOCALS[I])
408+
[preserves-definedness]
392409
393410
// Regular function call - full state switching and stack setup
394411
rule [termCallFunction]:

kmir/src/tests/integration/data/prove-rs/show/iterator-simple.main.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
│ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC
44
│ span: 0
55
6-
│ (1113 steps)
6+
│ (1116 steps)
77
├─ 3 (terminal)
88
│ #EndProgram ~> .K
99
│ function: main

0 commit comments

Comments
 (0)