[PATCH] D156238: [InstCombine] Generalize foldICmpWithMinMax

Yingwei Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 10:24:37 PDT 2023


dtcxzyw added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4947
+  return false;
+}
+Instruction *InstCombinerImpl::foldICmpWithMinMaxImpl(
----------------
goldstein.w.n wrote:
> See: `m_c_MaxOrMin` in PatternMatch. This can be:
> ```
> if(!match(Val, m_c_MaxOrMin(X, Y)))
> return false;
> MinMaxIntrinsic = cast<Intrinsic>(Val)->getIntrinsicID();
> return true;
> ```
`m_c_MaxOrMin` doesn't always match a `MinMaxIntrinsic`. It also matches the pattern `(x pred y) ? x : y`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156238/new/

https://reviews.llvm.org/D156238



More information about the llvm-commits mailing list