Skip to content

Commit

Permalink
fix: Fix issue with unresolved results (#5453)
Browse files Browse the repository at this point in the history
# Description

## Problem\*

check_for_underconstrained_values pass was producing false positives
because the value ids of results in the function were different from the
value ids used in other constraints and had to be resolved.

## Summary\*
Added checks to ensure we also resolve all values before using


## Additional Context



## Documentation\*

Check one:
- [x] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] **[For Experimental Features]** Documentation to be submitted in a
separate PR.

# PR Checklist\*

- [x] I have tested the changes locally.
- [ ] I have formatted the changes with [Prettier](https://prettier.io/)
and/or `cargo fmt` on default settings.
  • Loading branch information
Rumata888 authored Jul 9, 2024
1 parent 24d26c0 commit c4154cb
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Context {
.iter()
.chain(function.returns())
.filter(|id| function.dfg.get_numeric_constant(**id).is_none())
.copied();
.map(|value_id| function.dfg.resolve(*value_id));

let mut connected_sets_indices: HashSet<usize> = HashSet::new();

Expand Down Expand Up @@ -169,13 +169,13 @@ impl Context {
// Insert non-constant instruction arguments
function.dfg[*instruction].for_each_value(|value_id| {
if function.dfg.get_numeric_constant(value_id).is_none() {
instruction_arguments_and_results.insert(value_id);
instruction_arguments_and_results.insert(function.dfg.resolve(value_id));
}
});
// And non-constant results
for value_id in function.dfg.instruction_results(*instruction).iter() {
if function.dfg.get_numeric_constant(*value_id).is_none() {
instruction_arguments_and_results.insert(*value_id);
instruction_arguments_and_results.insert(function.dfg.resolve(*value_id));
}
}

Expand Down

0 comments on commit c4154cb

Please sign in to comment.