Skip to content

feat(riscv): Use the ! rewriter functions in the branch lowering#1065

Open
tobiasgrosser wants to merge 1 commit into
mainfrom
tobias/riscv-branches-bang-rewriter
Open

feat(riscv): Use the ! rewriter functions in the branch lowering#1065
tobiasgrosser wants to merge 1 commit into
mainfrom
tobias/riscv-branches-bang-rewriter

Conversation

@tobiasgrosser

@tobiasgrosser tobiasgrosser commented Jul 12, 2026

Copy link
Copy Markdown
Collaborator

Replace the proof-carrying WfRewriter calls in the branch instruction
selection with their panicking ! variants, which check their
preconditions at runtime instead. This removes all 24 sorrys from the
pass.

Dropping the sorrys re-enables the unused-variable linter for these
declarations, which exposes that convertBranch never uses its block
argument; remove it.

@tobiasgrosser tobiasgrosser added the RISCV The RISCV Dialect label Jul 12, 2026
@tobiasgrosser tobiasgrosser self-assigned this Jul 12, 2026
@tobiasgrosser tobiasgrosser added the RISCV The RISCV Dialect label Jul 12, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VeIR Benchmarks

Details
Benchmark suite Current: 30bf3b5 Previous: 86e3eaf Ratio
add-fold-worklist/create 2138000 ns (± 89433) 2281000 ns (± 109561) 0.94
add-fold-worklist/rewrite 3955000 ns (± 60305) 3831500 ns (± 58442) 1.03
add-fold-worklist-local/create 2190500 ns (± 107057) 2402000 ns (± 116565) 0.91
add-fold-worklist-local/rewrite 3751000 ns (± 109623) 3722000 ns (± 84795) 1.01
add-zero-worklist/create 2166000 ns (± 68064) 2382000 ns (± 119840) 0.91
add-zero-worklist/rewrite 2544000 ns (± 117885) 2526000 ns (± 71001) 1.01
add-zero-reuse-worklist/create 1776000 ns (± 65563) 2149000 ns (± 79534) 0.83
add-zero-reuse-worklist/rewrite 2064000 ns (± 84022) 2033000 ns (± 48703) 1.02
mul-two-worklist/create 2136000 ns (± 75939) 2409000 ns (± 116407) 0.89
mul-two-worklist/rewrite 5594000 ns (± 121349) 5506500 ns (± 268762) 1.02
add-fold-forwards/create 2179000 ns (± 84253) 2325500 ns (± 115467) 0.94
add-fold-forwards/rewrite 2934000 ns (± 34602) 2939000 ns (± 55488) 1.00
add-zero-forwards/create 2092000 ns (± 80828) 2345500 ns (± 110446) 0.89
add-zero-forwards/rewrite 1937000 ns (± 38790) 1904500 ns (± 32208) 1.02
add-zero-reuse-forwards/create 1842000 ns (± 56403) 1946500 ns (± 98021) 0.95
add-zero-reuse-forwards/rewrite 1598000 ns (± 72220) 1562000 ns (± 43519) 1.02
mul-two-forwards/create 2138000 ns (± 44008) 2344000 ns (± 104495) 0.91
mul-two-forwards/rewrite 3548000 ns (± 31987) 3632000 ns (± 156014) 0.98
add-zero-reuse-first/create 1830000 ns (± 110467) 1993500 ns (± 107618) 0.92
add-zero-reuse-first/rewrite 9000 ns (± 3044) 8500 ns (± 3395) 1.06
add-zero-lots-of-reuse-first/create 1818000 ns (± 83812) 2041000 ns (± 98132) 0.89
add-zero-lots-of-reuse-first/rewrite 776000 ns (± 58875) 765000 ns (± 19967) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Replace the proof-carrying `WfRewriter` calls in the branch instruction
selection with their panicking `!` variants, which check their
preconditions at runtime instead. This removes all 14 `sorry`s from the
pass.

Dropping the `sorry`s re-enables the unused-variable linter for these
declarations, which exposes that `convertBranch` never uses its `block`
argument; remove it.
@tobiasgrosser tobiasgrosser force-pushed the tobias/riscv-branches-bang-rewriter branch from c467ce0 to 30bf3b5 Compare July 12, 2026 06:46
@tobiasgrosser

Copy link
Copy Markdown
Collaborator Author

I would appreciate a comment on the block argument removal. @regehr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RISCV The RISCV Dialect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant