[llvm] [InstCombine] Add missing patterns for scmp and ucmp (PR #149225)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 18 03:26:08 PDT 2025


================
@@ -4638,5 +4681,20 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
                                      Align(MaskedLoadAlignment->getZExtValue()),
                                      CondVal, FalseVal));
 
+  // Canonicalize sign function ashr pattern: select (icmp slt X, 1), ashr X,
----------------
dtcxzyw wrote:

Please file a separate patch for this change.
We can also fold the commuted pattern:
```
select (icmp sgt X, 0), 1, (ashr X, BW - 1) -> scmp(X, 0)
```



https://github.com/llvm/llvm-project/pull/149225


More information about the llvm-commits mailing list