Skip to content

Commit ffb82ec

Browse files
committed
correctly transfer all bindings when analysing a wrapped precondition.
1 parent 1f0c92d commit ffb82ec

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

lib/dialect/include/rlc/dialect/DynamicArgumentAnalysis.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ enum TermType {
7474
Example: arg = arg2, memberAddress = [2, 1] maps to MemberAccess(MemberAccess(arg,2), 1)
7575
*/
7676
struct UnboundValue {
77-
mlir::Value argument;
77+
mlir::BlockArgument argument;
7878
llvm::SmallVector<uint64_t> memberAddress;
7979

8080
/*

lib/dialect/src/DynamicArgumentAnalysisPass.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,17 @@ DeducedConstraints DynamicArgumentAnalysis::findImposedConstraints(mlir::rlc::Ca
272272
}
273273
assert(argIndex != -1 && "Expected to find the argument.");
274274
DynamicArgumentAnalysis analysis(underlyingFunction, knownArgsOfUnderlyingFunction, argPicker, builder, loc);
275+
for(auto binding: bindings) {
276+
if(binding.first.memberAddress.size() != 0) {
277+
// the binding does not just correspond to an argument.
278+
auto indexOfArg = std::distance(
279+
call.getArgs().begin(),
280+
llvm::find(call.getArgs(), unbound.argument));
281+
// add an equivalent binding using the callee's arg.
282+
UnboundValue newUnboundValue {underlyingFunction.getPrecondition().getArgument(indexOfArg), binding.first.memberAddress};
283+
analysis.bindings.emplace_back(std::pair(newUnboundValue, binding.second));
284+
}
285+
}
275286
UnboundValue correspongindUnboundValue {underlyingFunction.getPrecondition().getArgument(argIndex), unbound.memberAddress};
276287
return analysis.deduceIntegerUnboundValueConstraints(correspongindUnboundValue);
277288
}

tool/rlc/test/fuzzer_pick_struct.rl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ act subact(ctx Test context_struct) -> Subact:
1919
t1.a == context_struct.b,
2020
t1.b > context_struct.a,
2121
t1.b < subact_frame_var,
22-
t1.inner.c == context_struct.b
22+
t1.inner.c == context_struct.b + t1.b
2323
}
2424

2525
act play() -> Play:

0 commit comments

Comments
 (0)