[PATCH] D156238: [InstCombine] Generalize foldICmpWithMinMax

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 10:31:12 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4947
+  return false;
+}
+Instruction *InstCombinerImpl::foldICmpWithMinMaxImpl(
----------------
dtcxzyw wrote:
> 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`.
Ah, my mistake keep as is.


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