[llvm] [InstCombine] Add transforms for `icmp uPred (trunc x),(truncOrZext(y))` -> `icmp uPred x,y` (PR #71309)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 5 01:53:45 PST 2023


================
@@ -1545,6 +1545,53 @@ Instruction *InstCombinerImpl::foldICmpTruncConstant(ICmpInst &Cmp,
   return nullptr;
 }
 
+/// Fold icmp (trunc X), (trunc Y).
+/// Fold icmp (trunc X), (zext Y).
+static Instruction *foldICmpTruncWithTruncOrExt(ICmpInst &Cmp,
+                                                InstCombinerImpl &IC,
+                                                const SimplifyQuery &Q) {
+  if (!Cmp.isEquality() && !Cmp.isUnsigned())
----------------
dtcxzyw wrote:

```suggestion
  if (Cmp.isSigned())
```

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


More information about the llvm-commits mailing list