As seen at [bugs:#4115], and the linked list at https://github.com/zlfn/alive-sdcc/blob/main/FINDINGS.md there are issues in many peephole optimizer rules. The rules didn't cause issues practically so far, since the issues can only be triggered by code SDCC does not currently generate (often triggering it would require code that doesn't make sense anyway).
But while looking into that, I also found that many rules are not currently tested in regression tests (list attached). This is likely due to changes in SDCC resulting in the code required to trigger them no longer being generated for the original reproducers.
Rules should get tests is sdcc/support/regression/tests or be removed.
Some rules that looked like they can no longer be triggered (due to better codegen, or earlier rules having been generalized) were removed in [r16996].
Related
Commit: [r16996]
Some tests were added in [r16997]. List of remaining untested rules attached.
Related
Commit: [r16997]