[llvm] [llvm][InstCombine] Fold signum(x) into scmp(x, 0) (PR #143445)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 06:18:14 PDT 2025
================
@@ -3603,6 +3603,18 @@ Instruction *InstCombinerImpl::foldSelectToCmp(SelectInst &SI) {
ICmpInst::getSwappedPredicate(ExtendedCmpPredicate) == Pred))
Replace = true;
+ // Handle the edge case (x > -1) ? zext(x != 0), -1
----------------
nikic wrote:
This can also occur with other constants, not just -1 / 0: https://alive2.llvm.org/ce/z/TIceGg
https://github.com/llvm/llvm-project/pull/143445
More information about the llvm-commits
mailing list