diff options
| author | AtariDreams <gfunni234@gmail.com> | 2024-04-22 03:48:31 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-22 09:48:31 +0200 |
| commit | a4bacb0f42ee8bd9d09baaae0fc0ff4650fbef2b (patch) | |
| tree | a3c0eaec18d1e25f312451e9c361ca65ed59407f /llvm/lib/CodeGen | |
| parent | 83f7a3a21f6cfbc209b3ccf183abc57c8c51fcc9 (diff) | |
| download | llvm-a4bacb0f42ee8bd9d09baaae0fc0ff4650fbef2b.tar.gz llvm-a4bacb0f42ee8bd9d09baaae0fc0ff4650fbef2b.tar.bz2 llvm-a4bacb0f42ee8bd9d09baaae0fc0ff4650fbef2b.zip | |
[SelectionDAG] Remove redundant KnownBits smin and smax operations (#89519)
It turns out that if any of the operations can be zero, and neither of
the operands can be proven to be positive, it is possible for smax to be
zero, and KnownBits cannot prove otherwise even with KnownBits::smax. In
fact, proving it based on the KnownBits itself at that point without
increasing the depth is actually, provably impossible.
Same with smin.
This covers all the possible cases and is proven to be complete.
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 7dbf83b7adee..b63b8b893fdb 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -5399,9 +5399,6 @@ bool SelectionDAG::isKnownNeverZero(SDValue Op, unsigned Depth) const { if (Op1.isNonZero() && Op0.isNonZero()) return true; - if (KnownBits::smax(Op0, Op1).isNonZero()) - return true; - return isKnownNeverZero(Op.getOperand(1), Depth + 1) && isKnownNeverZero(Op.getOperand(0), Depth + 1); } @@ -5417,9 +5414,6 @@ bool SelectionDAG::isKnownNeverZero(SDValue Op, unsigned Depth) const { if (Op1.isNonZero() && Op0.isNonZero()) return true; - if (KnownBits::smin(Op0, Op1).isNonZero()) - return true; - return isKnownNeverZero(Op.getOperand(1), Depth + 1) && isKnownNeverZero(Op.getOperand(0), Depth + 1); } |
