[PATCH] D111101: [lld][WebAssembly] Remove redundant check for undefined global (NFC)

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 10:59:14 PDT 2021


aheejin updated this revision to Diff 377301.
aheejin marked an inline comment as done.
aheejin added a comment.

Comment fix


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111101

Files:
  lld/wasm/Relocations.cpp


Index: lld/wasm/Relocations.cpp
===================================================================
--- lld/wasm/Relocations.cpp
+++ lld/wasm/Relocations.cpp
@@ -32,17 +32,13 @@
 }
 
 static bool allowUndefined(const Symbol* sym) {
-  // Undefined functions and globals with explicit import name are allowed to be
-  // undefined at link time.
-  if (auto *f = dyn_cast<UndefinedFunction>(sym))
-    if (f->importName || config->importUndefined)
-      return true;
-  if (auto *g = dyn_cast<UndefinedGlobal>(sym))
-    if (g->importName)
-      return true;
-  if (auto *g = dyn_cast<UndefinedGlobal>(sym))
-    if (g->importName)
-      return true;
+  // Symbols with explicit import names are always allowed to be undefined at
+  // link time.
+  if (sym->importName)
+    return true;
+  if (isa<UndefinedFunction>(sym) || config->importUndefined)
+    return true;
+
   return config->allowUndefinedSymbols.count(sym->getName()) != 0;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111101.377301.patch
Type: text/x-patch
Size: 946 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211005/cacdfe3b/attachment.bin>


More information about the llvm-commits mailing list