[PATCH] D148275: [InstCombine] support fold select(X|Y,X|Y,X) to X|Y
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 16 16:22:21 PDT 2023
goldstein.w.n added inline comments.
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4585
+ if (Pred == ICmpInst::Predicate::ICMP_EQ) {
+ Value *X;
----------------
Should we also have `select(X|Y != 0, X | Y, X or Y)`?
================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:4588
+ Value *Y;
+ // select(X | Y == 0, X or Y, X | Y) -> X | Y
+ if (match(CondVal, m_ICmp(Pred, m_Specific(FalseVal), m_Zero())) &&
----------------
You could also do:
`select(X | Y == X, X, X | Y)` -> `X | Y`
and
`select (X|Y == Y, Y, X|Y)` -> `X|Y`
https://alive2.llvm.org/ce/z/hawAog
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148275/new/
https://reviews.llvm.org/D148275
More information about the llvm-commits
mailing list