[llvm] [ConstraintElim] decompose subtract with guard as precondition (PR #209615)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 04:47:22 PDT 2026
================
@@ -664,6 +664,15 @@ static Decomposition decompose(Value *V,
return V;
}
+ if (match(V, m_Sub(m_Value(Op0), m_Value(Op1)))) {
----------------
antoniofrighetto wrote:
May as well refactor the code above and merge into something like:
```cpp
if (match(V, m_Sub(m_Value(Op0), m_Value(Op1)))) {
if (!cast<OverflowingBinaryOperator>(V)->hasNoUnsignedWrap())
Preconditions.emplace_back(CmpInst::ICMP_ULE, Op1, Op0);
auto ResA = decompose(Op0, Preconditions, IsSigned, DL);
auto ResB = decompose(Op1, Preconditions, IsSigned, DL);
if (!ResA.sub(ResB))
return ResA;
return V;
}
```
https://github.com/llvm/llvm-project/pull/209615
More information about the llvm-commits
mailing list