[PATCH] D86050: [SCEV] Refactor isHighCostExpansionHelper

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 03:42:30 PDT 2020


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

Alright, i think this is NFC now..
Thanks



================
Comment at: llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h:241
     while (!Worklist.empty()) {
-      const SCEV *S = Worklist.pop_back_val();
-      if (isHighCostExpansionHelper(S, L, *At, BudgetRemaining, *TTI, Processed,
-                                    Worklist))
+      SCEVOperand WorkItem = Worklist.pop_back_val();
+      if (isHighCostExpansionHelper(WorkItem, L, *At, BudgetRemaining,
----------------
potentially `const SCEVOperand WorkItem = `


================
Comment at: llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h:411
+  bool isHighCostExpansionHelper(
+    SCEVOperand &WorkItem, Loop *L, const Instruction &At, int &BudgetRemaining,
+    const TargetTransformInfo &TTI,
----------------
Here and elsewhere: `const SCEVOperand &WorkItem` - it shouldn't be ever mutated.


================
Comment at: llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp:2187
+  int Cost = 0;
+  SmallVector<unsigned, 2> Opcodes;
+
----------------
`Opcodes` needs a good comment, even i'm currently having trouble understanding it.


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

https://reviews.llvm.org/D86050



More information about the llvm-commits mailing list