[PATCH] D97863: [LSR] adjust isHighCostExpansion function for Mul case

Danila Malyutin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 3 08:21:04 PST 2021


danilaml created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
danilaml requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97863

Files:
  llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp


Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -968,14 +968,15 @@
       // multiplication already generates this expression.
       if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(Mul->getOperand(1))) {
         Value *UVal = U->getValue();
-        for (User *UR : UVal->users()) {
+        return llvm::none_of(UVal->users(), [&](User *UR) {
           // If U is a constant, it may be used by a ConstantExpr.
           Instruction *UI = dyn_cast<Instruction>(UR);
           if (UI && UI->getOpcode() == Instruction::Mul &&
               SE.isSCEVable(UI->getType())) {
             return SE.getSCEV(UI) == Mul;
           }
-        }
+          return false;
+        });
       }
     }
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97863.327807.patch
Type: text/x-patch
Size: 892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210303/ff09aae1/attachment.bin>


More information about the llvm-commits mailing list