This reverses a questionable IR canonicalization when a truncate is free:
sra (add (shl X, N1C), AddC), N1C --> sext (add (trunc X to (width - N1C)), AddC')
https://rise4fun.com/Alive/slRC
More details in PR42644:
https://bugs.llvm.org/show_bug.cgi?id=42644
I limited this to pre-legalization for code simplicity because that should be enough to reverse the IR patterns. I don't have any evidence (no regression test diffs) that we need to try this later.
Don't we also need for N0 to be one-use?