I have realized that the patch is indeed a fix, not a workaround.
I checked: neither GCC nor LLVM will assemble
lui x1, -4
The LLVM compiled models the arguments to LUI and AUIPC as UIMM (unsigned immediate) or UIMM20 (20 bit unsigned immediate).
I should have checked this from the start. I jumped to the conclusion that both formats (signed decimal, two's complement) for negative arguments should be supported, and that I was encountering a bug. I apologize to all for the unnecessary back-and-forth.
I don't yet see a reason why llvm and gcc could not support a signed number in decimal format, perhaps requiring a pseudo-instruction.
This might be desirable, if only in support of assembly programming.
On the other hand, it is easy to make the conversion to a two's-complement number.
Richard