[PATCH] D76273: [NFCI][SCEV] Avoid recursion in SCEVExpander::isHighCostExpansion*()

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 18 03:46:22 PDT 2020


mkazantsev added inline comments.


================
Comment at: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:195
+      while (!Worklist.empty()) {
+        const SCEV *S = Worklist.front();
+        Worklist.pop_front(); // FIFO
----------------
I'm not getting why do you need a worklist. On the 1st iteration of this loop, you put one value to the WorkList and then remove it. `isHighCostExpansionHelper` always puts one element to the worklist and then returns. Therefore the size of your FIFO is either 0 or 1. Do you really need to use deque for it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76273





More information about the llvm-commits mailing list