[PATCH] D100170: [NARY] Don't optimize min/max if there are side uses

Valeriy Dmitriev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 13:48:04 PDT 2021


vdmitrie added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/NaryReassociate.cpp:595
   for (unsigned int i = 0; i < 2; ++i) {
-    if (match(LHS, m_MaxMin)) {
+    if (LHS->getNumUses() <= 2 && match(LHS, m_MaxMin)) {
       const SCEV *AExpr = SE->getSCEV(A), *BExpr = SE->getSCEV(B);
----------------
Just a hint:
 /// This is a linear time operation.  Use hasOneUse, hasNUses, or
 /// hasNUsesOrMore to check for specific values.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100170



More information about the llvm-commits mailing list