[PATCH] D101840: [InstSimplify] ctlz(x) -> 0 if x is known negative number

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 4 10:31:43 PDT 2021


xbolva00 marked an inline comment as done.
xbolva00 added inline comments.


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:5412-5413
       return X;
     if (match(Op0, m_AShr(m_Negative(), m_Value())))
       return Constant::getNullValue(ReturnType);
+    if (isKnownNegative(Op0, Q.DL, /*Depth=*/0, Q.AC, Q.CxtI, Q.DT))
----------------
spatel wrote:
> Enhance isKnownNegative to know that ashr of negative constant is still negative? Then we could remove the match here.
Yeah


================
Comment at: llvm/lib/Analysis/InstructionSimplify.cpp:5412-5413
       return X;
     if (match(Op0, m_AShr(m_Negative(), m_Value())))
       return Constant::getNullValue(ReturnType);
+    if (isKnownNegative(Op0, Q.DL, /*Depth=*/0, Q.AC, Q.CxtI, Q.DT))
----------------
xbolva00 wrote:
> spatel wrote:
> > Enhance isKnownNegative to know that ashr of negative constant is still negative? Then we could remove the match here.
> Yeah
As followup I think.


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

https://reviews.llvm.org/D101840



More information about the llvm-commits mailing list