[llvm] [ConstraintElim] Do not allow overflows in `Decomposition` (PR #140541)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon May 19 12:52:50 PDT 2025
================
@@ -534,20 +536,21 @@ static Decomposition decompose(Value *V,
}
if (match(V, m_NSWAdd(m_Value(Op0), m_Value(Op1))))
- return MergeResults(Op0, Op1, IsSigned);
+ if (auto Decomp = MergeResults(Op0, Op1, IsSigned))
+ return *Decomp;
if (match(V, m_NSWSub(m_Value(Op0), m_Value(Op1)))) {
auto ResA = decompose(Op0, Preconditions, IsSigned, DL);
auto ResB = decompose(Op1, Preconditions, IsSigned, DL);
- ResA.sub(ResB);
- return ResA;
+ if (!ResA.sub(ResB))
+ return ResA;
----------------
fhahn wrote:
Does it make sense to continue below after overflow? Should we just return std::nullopt?
Same for the others
https://github.com/llvm/llvm-project/pull/140541
More information about the llvm-commits
mailing list