[PATCH] D154206: [InstCombine] Fold comparison of usub.sat
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 30 08:49:37 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3438
+ Value *II1 = II->getOperand(1);
+ ICmpInst::Predicate EqPred =
+ Pred == ICmpInst::ICMP_EQ ? ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;
----------------
`EqPred` is kind of confusing (since its a non-equality pred), maybe `NewPred`?
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:3673
+ Value *II1 = II->getOperand(1);
+ if (match(II1, m_Constant())) {
+ if (ICmpInst::compare(APInt::getZero(C.getBitWidth()), C, Pred))
----------------
`m_ImmConstant()` here as well.
================
Comment at: llvm/test/Transforms/InstCombine/icmp-usub-sat.ll:120
+
+declare i8 @llvm.usub.sat.i8(i8, i8)
----------------
nikic wrote:
> Add a multi-use and vector test.
Can you split tests to seperate patch (make series with tests as Patch1 then impl as Patch2) so we can see the diff this patch causes.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154206/new/
https://reviews.llvm.org/D154206
More information about the llvm-commits
mailing list