[PATCH] D69252: [InstCombine] Canonicalize sadd.with.overflow to sadd.sat
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 12:13:55 PDT 2019
lebedev.ri added a comment.
This patch is doing too much at once - i think there are ~14 folds being added here.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:1763
+ if (!match(Limit, m_Select(m_ICmp(Pred, m_Value(Op), m_APInt(C)),
+ m_Value(A), m_Value(B))))
+ return false;
----------------
s/A/TrueVal/, s/B/FalseVal/
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:1813
+ else if (II->getIntrinsicID() == Intrinsic::sadd_with_overflow &&
+ IsSignedSaturateLimit(TrueVal, true))
+ // X + Y overflows ? (X <s 0 ? INTMIN : INTMAX) : X + Y --> sadd_sat X, Y
----------------
`/*IsAdd=*/true`
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:1824
+ else if (II->getIntrinsicID() == Intrinsic::ssub_with_overflow &&
+ IsSignedSaturateLimit(TrueVal, false))
+ // X - Y overflows ? (X <s 0 ? INTMIN : INTMAX) : X - Y --> ssub_sat X, Y
----------------
`/*IsAdd=*/false`
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69252/new/
https://reviews.llvm.org/D69252
More information about the llvm-commits
mailing list