[PATCH] D158364: [DAG] SimplifyDemandedBits - if we're only demanding the signbits, a MIN/MAX node can be simplified to a OR or AND node

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 31 10:55:31 PDT 2023


goldstein.w.n added a comment.

Other than the few nits looks good.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:2161
+    case ISD::SMAX:
+      // TODO: Add KnownBits::sge/sgt handling.
+      break;
----------------
Should compute Known for `smin`/`smax`? Imo also just fill in the TODO. Its not much code required.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:2171
+    case ISD::UMAX:
+      Known = KnownBits::umax(Known0, Known1);
+      if (std::optional<bool> IsUGE = KnownBits::uge(Known0, Known1))
----------------
I guess already existed but Known computation should be after the condition folding has failed already.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158364



More information about the llvm-commits mailing list