[PATCH] D134234: [llvm] Support forward-referenced globals with dso_local_equivalent

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 14:32:57 PDT 2022


MaskRay added inline comments.


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:220
+  // are references after the function was defined.  Resolve those now.
+  while (!ForwardRefDSOLocalEquivalents.empty()) {
+    GlobalValue *GV = nullptr;
----------------
Use a range-based for loop and clear `ForwardRefDSOLocalEquivalents`?


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:227
+    else if (GVRef.UIntVal < NumberedVals.size())
+      GV = dyn_cast<GlobalValue>(NumberedVals[GVRef.UIntVal]);
+
----------------
This line has no test coverage.


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:230
+    if (!GV)
+      return error(GVRef.Loc, "unknown function '" + GVRef.StrVal +
+                                  "'referenced by dso_local_equivalent");
----------------
The error is not tested.


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:234
+    if (!GV->getValueType()->isFunctionTy())
+      return error(GVRef.Loc,
+                   "expected a function, alias to function, or ifunc "
----------------
The error is not tested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134234



More information about the llvm-commits mailing list