[DAG] Fold (abs (sign_extend_inreg x)) -> (zero_extend (abs (truncate x))) (PR43370)
If the upper half of an abs() is all sign bits, then we can perform the abs() using just the lower half and then zero extend. I've limited the DAG combine to only sign_extend_inreg (and free truncate/zero_extend) to minimise any later promotion issues, but for legalization a similar fold can use ComputeNumSignBits to be more aggressive. Alive2: https://alive2.llvm.org/ce/z/y32fS4 Fixes #43370 Differential Revision: https://reviews.llvm.org/D136559
Loading
Please sign in to comment