[PATCH] D144248: [InstCombine] canonicalize urem as cmp+select (part 2)

Erik Desjardins via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 10:40:10 PST 2023


erikdesjardins added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:3918-3919
+      isImpliedByDomCondition(Pred, LHS, RHS, Q.CxtI, Q.DL);
+  if (Checked && *Checked == true)
+    return getTrue(ITy);
+
----------------
This can be:

```
if (Checked)
  return *Checked ? getTrue(ITy) : getFalse(ITy);
```

since it's also useful to know that the dominating condition is false.

I expect you'll hit this case if you add a test withj the dominating icmp changed to uge and swap the branch targets


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144248/new/

https://reviews.llvm.org/D144248



More information about the llvm-commits mailing list