[DAGCombiner][RISCV] Pre-promote (zext (abs X)) to (abs (sext X)) when X has an illegal type.
Type legalization will insert a sign extend anyway. By doing it early we can remove the zext. ComputeNumSignBits can't spot it after type legalization because type legalization may expand the abs to sra+xor+sub. If the zext result type is larger than the type to be promoted to, we'll promote to a legal type and then zext the rest of the way. If the legal type is larger than the destination type we can promote and then truncate. Reviewed By: asb Differential Revision: https://reviews.llvm.org/D140509
Loading
Please sign in to comment