I am trying to implement sign extension optimizations for the RISCV target but I am a little confused. For example in the pass
CorrelatedValuePropagation exists a function processSext that converts
all sexts to zexts inside a function. Generally that is cheaper on most targets but not on RISCV because sext is no-op. Can someone help me outline an approach to undo the effect of this pass in the RISCV?
Note that some RISCV passes to address this problem have been already been created by Craig Topper.