[SV] Two state flag is not preserved in SV if inversion
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
In `SV/canonicalization.mlir` there is a test that inverting if-statement when the condition has a bing flag but the value inverted value doesn't have a bin flag.
```
// CHECK-LABEL: func @invert_if(%arg0: i1, %arg1: i1) {
// CHECK-NEXT: %true = hw.constant true
// CHECK-NEXT: [[FD:%.*]] = hw.constant -2147483646 : i32
// CHECK-NEXT: sv.initial {
// CHECK-NEXT: %0 = comb.xor %arg0, %arg1, %true : i1
// CHECK-NEXT: sv.if %0 {
// CHECK-NEXT: sv.fwrite [[FD]], "Foo"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: return
// CHECK-NEXT: }
func.func @invert_if(%arg0: i1, %arg1 : i1) {
sv.initial {
%false = hw.constant false
%0 = comb.xor bin %arg0, %arg1 : i1
sv.if %0 {
} else {
%fd = hw.constant 0x80000002 : i32
sv.fwrite %fd, "Foo"
}
}
return
}
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the inversion test in SV/canonicalization.mlir and inspect its CHECK lines alongside the @invert_if operation. Trace how the SV if condition is inverted, then verify that the two-state/bin flag is preserved and that the test output reflects the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100