[PATCH] D107148: [InstCombine] Fold two-value clamp patterns

Qiu Chaofan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 31 10:32:25 PDT 2021


qiucf added a comment.

In D107148#2964910 <https://reviews.llvm.org/D107148#2964910>, @spatel wrote:

> Sorry for missing this review earlier.
> I implemented the corresponding folds for intrinsics with:
> https://reviews.llvm.org/rG025bb5290379
>
> Can you confirm that the pattern matching and tests here correspond to those (replace the intrinsics with cmp+sel or vice-versa)?

Yes, it does similar thing to this. So will it be better to fold such cmp-select pattern to the intrinsic?



================
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;
----------------
RKSimon wrote:
> It'd be better if we could use m_APInt here to support vectors (including handling undef element cases).
Hmm.. Does `match(xxx, m_APInt(&x))` support vector type?


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