[PATCH] D120000: [1/2] TLS loads opimization (hoist)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 12:59:10 PST 2022


craig.topper added inline comments.


================
Comment at: llvm/include/llvm/Transforms/Scalar/TLSVariableHoist.h:68
+#include "llvm/IR/PassManager.h"
+#include <map>
+
----------------
You're not using std::map in this file


================
Comment at: llvm/lib/Transforms/Scalar/TLSVariableHoist.cpp:126
+      continue;
+    if (!GV->isThreadLocal())
+      continue;
----------------
Merge into the previous if with ||


================
Comment at: llvm/lib/Transforms/Scalar/TLSVariableHoist.cpp:135
+    } else {
+      TLSCandMap[GV].addUser(Inst, Idx);
+    }
----------------
This line should work for the case when GV isn't already in the map. The operator[] on the MapVector will default construct a TLS candidate before calling addUser. So you don't need to check TLSCandMap.count


================
Comment at: llvm/lib/Transforms/Scalar/TLSVariableHoist.cpp:223
+                                   LoopInfo &LI) {
+  if (Fn.hasOptNone())
+    return false;
----------------
This might be handled by the pass manager for the new pass manager. For the old pass manager it is part of skipFunction.


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

https://reviews.llvm.org/D120000



More information about the llvm-commits mailing list