[PATCH] D127084: [MCA] Allow mca::Instruction-s to be recycled and reused

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 03:16:02 PDT 2022


andreadb added a comment.

Hi Min,

Patch looks good modulo a minor nit (see my comment below).

Thanks!
-Andrea



================
Comment at: llvm/include/llvm/MCA/IncrementalSourceMgr.h:43-56
+  /// Called when an instruction is no longer needed.
+  llvm::function_ref<void(Instruction *)> InstFreedCallback;
+
 public:
   IncrementalSourceMgr() : TotalCounter(0U), EOS(false) {}
 
+  void clear();
----------------
I suggest to use a `using` for that type, and then use that new type definition in `setOnInstFreedCallback` (instead of using decltype).

Something like this:

```
using InstFreedCallbackTy = llvm::function_ref<void(Instruction *)>;
```


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

https://reviews.llvm.org/D127084



More information about the llvm-commits mailing list