[PATCH] D149682: [SelectionDAG][NFCI] Use common logic for identifying MMI vars

Felipe de Azevedo Piovezan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 05:19:38 PDT 2023


fdeazeve added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/FunctionLoweringInfo.h:193
+  // lowering and before ISel proper.
+  SmallPtrSet<const DbgDeclareInst *, 4> PreprocessedDbgDeclares;
+
----------------
aprantl wrote:
> 4 seems like a low number. You could hack up a version of clang to dump the number of elements at the end and then pick something close to the median. Or you could pick 8 :-)
(Side note, I found out about the `st --summary` CLI tool, which is very useful)

Hah! This actually revealed a problem with the patch :)

Because this class doesn't rely on RAII (we keep reusing it for all functions in the Module), it has a "clear" method that needs to be manually updated. When I tried compiling a big-ish cpp file, the size of the set kept growing and growing. I've now fixed this.

I compiled APInt.cpp with this change printing the set size after each function is lowered:


```
min     q1      median  q3      max
0       0       0       0       17       # O2
0       1       2       4       29       # O0

```

When compiling SelectionDAGISel.cpp, we also get similar ideas:


```
min     q1      median  q3      max
0       0       0       0       15       # O2
0       1       1       2       258      # O0
```

Since one of the Q3 == 4, and eyeballing the numbers there was a decent chunk of values in the [5;8] range, I'll just go ahead and use 8 to make the vast majority of cases fall in the "Small" case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149682



More information about the llvm-commits mailing list