[PATCH] D156238: [InstCombine] Generalize foldICmpWithMinMax
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 24 11:26:26 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:4947
+ return false;
+}
+Instruction *InstCombinerImpl::foldICmpWithMinMaxImpl(
----------------
goldstein.w.n wrote:
> 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.
But why not `dyn_cast<MinMaxIntrinsic>`? The select pattern is non-canonical and as such not relevant for InstCombine.
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