stm8instructionSize() reports 2 instead of 3 as instruction size for jp. It reports 3 instead of 2 for addw sp, #byte.
I see this error in revision #8712. Enabling the debug fprintf in line 113 of SDCCpeeph.c helped me find this bug, and is probably useful in debugging it and checking for similar ones.
Philipp
I have changed peep.c in a way that makes this bug no longer that bad: We now might miss some optimization potential, but shouldn't generate wrong assembly any more; thus I've enabled peepholes for optimzing absolute into relative jumps.
Still fixing this bug might allow us to optimize a bit more in a bit more cases.
Philipp
Fixed in revision #8907.
Philipp