[PATCH] D73716: [SCEV] SCEVExpander::isHighCostExpansionHelper(): begin cost modelling - model cast cost

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 4 19:35:18 PST 2020


mkazantsev added inline comments.


================
Comment at: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:176
 
-    /// Return true for expressions that may incur non-trivial cost to evaluate
-    /// at runtime.
+    /// Return true for expressions that can't be evaluate at runtime
+    /// within given \b Budged.
----------------
evaluate -> evaluated?


================
Comment at: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:190
+        return true;
+      return BudgetRemaining < 0;
     }
----------------
You already check this inside the helper, why do it twice?


================
Comment at: llvm/lib/Analysis/ScalarEvolutionExpander.cpp:2164
+  if (auto *CastExpr = dyn_cast<SCEVCastExpr>(S)) {
+    unsigned Opcode;
+    switch (S->getSCEVType()) {
----------------
Does it really need to be opcode, or we can pass SCEVType to `getOperationCost`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73716





More information about the llvm-commits mailing list