[PATCH] D142481: [DAGCombine] fp_to_sint isSaturatingMinMax

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 09:08:22 PST 2023


RKSimon added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5139
+    ConstantSDNode *LowerBound = isConstOrConstSplat(N3);
+    if (LowerBound->isZero()) {
+      EVT IntVT = N0.getValueType();
----------------
if (isNullOrNullSplat(N3)) ?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5146
+        uint32_t MinBitWidth =
+          APFloatBase::semanticsMaxExponent(Semantics) + 2;
+        if (IntVT.getSizeInBits() >= MinBitWidth) {
----------------
Would it be useful to have a helper method instead of this raw semanticsMaxExponent call (+ increase for the sign bit?) - canEvaluateTruncated in InstCombineCasts has a similar calculation that could use the helper as well, but that already has a comment describing what's going on.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142481



More information about the llvm-commits mailing list