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

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 23:05:22 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())
----------------
goldsteinn wrote:

Agreed less code although think the original shows intents of the lemma better. But no strong feelings. Changing.

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


More information about the llvm-commits mailing list