[PATCH] D143368: [InstCombine] Look through truncate to fold icmp with intrinsics

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 8 12:16:48 PST 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4918
 
+  if (auto *II = dyn_cast<IntrinsicInst>(X)) {
+    if (II->getIntrinsicID() == Intrinsic::ctpop ||
----------------
Imo it makes more sense to do this generically.

`(icmp P (trunc(X), C))` if `KnownBits(X)[OrigWidth:TruncWidth] == 0` just drop the truncate. That will cover all these intrins + any other cases that happen to come up.


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

https://reviews.llvm.org/D143368



More information about the llvm-commits mailing list