[PATCH] D64285: [InstCombine] Fold select (icmp sgt x, -1), lshr (X, Y), ashr (X, Y) to ashr (X, Y))
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 06:37:33 PDT 2019
- Previous message: [PATCH] D64285: [InstCombine] Fold select (icmp sgt x, -1), lshr (X, Y), ashr (X, Y) to ashr (X, Y))
- Next message: [PATCH] D64285: [InstCombine] Fold select (icmp sgt x, -1), lshr (X, Y), ashr (X, Y) to ashr (X, Y))
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
xbolva00 marked an inline comment as done.
xbolva00 added inline comments.
================
Comment at: lib/Analysis/InstructionSimplify.cpp:92-93
+ match(CmpLHS, m_Specific(X))) {
+ if (!cast<BinaryOperator>(TrueVal)->isExact() &&
+ cast<BinaryOperator>(FalseVal)->isExact())
+ return nullptr;
----------------
xbolva00 wrote:
> lebedev.ri wrote:
> > lebedev.ri wrote:
> > > ```
> > > /// If either the `ashr` is non-`exact`, or `lshr` is exact too, then we can just return the `ashr` instruction.
> > > ```
> > > i think it may be less confusing to flip the `if` accordingly.
> > Hmm, also, as i've recently seen, `cast<BinaryOperator>` is going to break for constant expressions.
> > Let's just do the most obvious thing instead:
> > ```
> > if (match(TrueVal, m_LShr(m_Value(X), m_Value(Y))) &&
> > match(FalseVal, m_AShr(m_Specific(X), m_Specific(Y))) &&
> > match(CmpLHS, m_Specific(X)) &&
> > (!match(FalseVal, m_Exact()) || match(TrueVal, m_Exact())))
> > ```
> m_Exact() not exists?
m_Exact(m_BinOp()).. okay
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64285/new/
https://reviews.llvm.org/D64285
- Previous message: [PATCH] D64285: [InstCombine] Fold select (icmp sgt x, -1), lshr (X, Y), ashr (X, Y) to ashr (X, Y))
- Next message: [PATCH] D64285: [InstCombine] Fold select (icmp sgt x, -1), lshr (X, Y), ashr (X, Y) to ashr (X, Y))
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the llvm-commits
mailing list