[PATCH] D156777: [SelectionDAG] Add/Improve cases in `isKnownNeverZero`
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 2 09:32:20 PDT 2023
goldstein.w.n marked 2 inline comments as done.
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5100
+
+ Op = PeekThroughCasts(Op);
+
----------------
arsenm wrote:
> Should this just go through the recursive case like normal?
Personally think its clearer to have casts simply handled ahead of time, but no strong attachment/opinion so adding back to recursive case.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:5169-5172
+ APInt MaxCnt = computeKnownBits(Op.getOperand(1), Depth + 1).getMaxValue();
+ if (MaxCnt.ule(ValKnown.getBitWidth()) &&
+ !ValKnown.One.lshr(MaxCnt).isZero())
return true;
----------------
arsenm wrote:
> Should try the RHS operand first as it's canonically simpler
Hmm? In a SRL we can't canonicalize constants to RHS. Also doing LHS first gives us a fast out (no need to compute RHS if we have negative value, but we can't get same early out with RHS).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156777/new/
https://reviews.llvm.org/D156777
More information about the llvm-commits
mailing list