[InstCombine] Fold icmps comparing usub_sat with a constant
This patch introduces a fold for the operation "usub_sat(X, C) pred C2" where "C" and "C2" are constants. The fold is: usub_sat(X, C) pred C2 => (X < C) || ((X - C) pred C2) -> when (0 pred C2) is true => (X >= C) && ((X - C) pred C2) -> when (0 pred C2) is false These expressions can generally be folded into a simpler expression. As they can sometimes emit more than one instruction, they are limited to cases where the "usub_sat" has only one user. Fixes #58342. Proofs: https://alive2.llvm.org/ce/z/ws_N2J Differential Revision: https://reviews.llvm.org/D154206
Loading
Please sign in to comment