[llvm] [CodeGen] Refactor and document ThunkInserter (PR #97468)

Anatoly Trosinenko via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 06:27:18 PDT 2024


================
@@ -183,15 +183,13 @@ static const struct ThunkNameAndReg {
 namespace {
 struct SLSBLRThunkInserter : ThunkInserter<SLSBLRThunkInserter> {
   const char *getThunkPrefix() { return SLSBLRNamePrefix; }
-  bool mayUseThunk(const MachineFunction &MF, bool InsertedThunks) {
-    if (InsertedThunks)
-      return false;
+  bool mayUseThunk(const MachineFunction &MF) {
+    // FIXME: ComdatThunks is only accumulated until the first thunk is created.
----------------
atrosinenko wrote:

Not sure how to explain it in a single line - using `&=` seemed a bit confusing to me at first, as it suggests that `ComdatThunks` is accumulated and at the end is used to determine if the thunk functions should be marked comdat. And it really is, but due to the usage of MachineFunctionPass, it is only accumulated until the first MF that triggers thunk insertion.

https://github.com/llvm/llvm-project/pull/97468


More information about the llvm-commits mailing list