[compiler-rt] [llvm] [ThinLTO][TypeProf] Import local-linkage global var for mod1:func_foo-> mod2:local-var edge (PR #100448)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 22:10:45 PDT 2024


================
@@ -174,6 +174,17 @@ static cl::opt<std::string> WorkloadDefinitions(
              "}"),
     cl::Hidden);
 
+static cl::opt<bool> ImportAssumeUniqueLocal(
+    "import-assume-unique-local", cl::init(false),
+    cl::desc(
+        "By default, a local-linkage global variable won't be imported in the "
+        "edge mod1:func -> mod2:local-var (from value profiles) since compiler "
+        "cannot assume mod2 is compiled with full path which gives local-var a "
+        "program-wide unique GUID. Set this option to true will help cross "
+        "module import of such variables. This is only safe if the compiler "
----------------
minglotus-6 wrote:

FYI, I double checked whether compiler correctness can rely on the fact that full file paths are used. My takeaway is that bazel doesn't fail the executable compilation if local paths are used (if any in a unconventional way) so I don't plan to turn on this option.

Yet still `NumDefs == 1` condition (https://github.com/llvm/llvm-project/pull/100448/files#diff-e7cb370fee46f0f773f2b5429dfab36b75126d3909ae98ee87ff3d0e3f75c6e9R215) should hold true for many internal-linkage vtables as long as full paths are indeed used.

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


More information about the llvm-commits mailing list