signed vs unsigned CSSize in emitEpilogue

Hi everyone!

While working on a research project I discovered a curiosity in emitEpilogue, line 1862 ( in X86FrameLowering.cpp (X86 Target). In the case where IsWin64Prologue is false, the LEAAmount is equal to the negative CSSize (makes sense). However, as CSSize is an unsigned int, the negation leads to an overflow. IIUC the code just happens to work because the (now positive) LEAAmount is passed to addRegOffset which expects a signed integer and it is converted back to a signed value. While the code works, I find it slightly unintuitive and it bit me when I tried to use the LEAAmount in a different way. Am I missing some important insight here?

Kind regards