[PATCH] D107148: [InstCombine] Fold two-value clamp patterns
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 25 05:33:27 PDT 2021
RKSimon added a reviewer: nikic.
RKSimon added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3100
+ if (auto *C1 = dyn_cast<ConstantInt>(TrueSI->getFalseValue()))
+ if (auto *C2 = dyn_cast<ConstantInt>(FalseVal)) {
+ Value *Inner, *N, *InnerC;
----------------
It'd be better if we could use m_APInt here to support vectors (including handling undef element cases).
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:3110
+ InnerFlavor == SelectPatternFlavor::SPF_SMAX &&
+ C2->getValue() == C1->getValue() + 1))
+ return SelectInst::Create(
----------------
Can we use m_SMin etc. ? Ideally we'd have something that matches min/max intrinsics as well as select patterns.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107148/new/
https://reviews.llvm.org/D107148
More information about the llvm-commits
mailing list