[PATCH] D65686: IR: Remove verifier check for GlobalValues with private linkage named after a comdat.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 17:34:53 PDT 2019


pcc created this revision.
pcc added reviewers: rnk, majnemer.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
pcc updated this revision to Diff 213152.
pcc added a comment.

- Remove decl


This check is only meaningful for COFF and it is perfectly valid to create
such a GlobalValue in ELF. Since we don't have target-specific verifier
checks, just remove the check.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65686

Files:
  llvm/lib/IR/Verifier.cpp
  llvm/test/Verifier/comdat2.ll


Index: llvm/test/Verifier/comdat2.ll
===================================================================
--- llvm/test/Verifier/comdat2.ll
+++ llvm/test/Verifier/comdat2.ll
@@ -1,5 +1,6 @@
-; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+; This used to be invalid, but now it's valid.  Ensure the verifier
+; doesn't reject it.
+; RUN: llvm-as %s -o /dev/null
 
 $v = comdat any
 @v = private global i32 0, comdat($v)
-; CHECK: comdat global value has private linkage
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -378,9 +378,6 @@
     for (const NamedMDNode &NMD : M.named_metadata())
       visitNamedMDNode(NMD);
 
-    for (const StringMapEntry<Comdat> &SMEC : M.getComdatSymbolTable())
-      visitComdat(SMEC.getValue());
-
     visitModuleFlags(M);
     visitModuleIdents(M);
     visitModuleCommandLines(M);
@@ -404,7 +401,6 @@
   void visitMDNode(const MDNode &MD);
   void visitMetadataAsValue(const MetadataAsValue &MD, Function *F);
   void visitValueAsMetadata(const ValueAsMetadata &MD, Function *F);
-  void visitComdat(const Comdat &C);
   void visitModuleIdents(const Module &M);
   void visitModuleCommandLines(const Module &M);
   void visitModuleFlags(const Module &M);
@@ -1305,14 +1301,6 @@
            N.getRawEntity());
 }
 
-void Verifier::visitComdat(const Comdat &C) {
-  // The Module is invalid if the GlobalValue has private linkage.  Entities
-  // with private linkage don't have entries in the symbol table.
-  if (const GlobalValue *GV = M.getNamedValue(C.getName()))
-    Assert(!GV->hasPrivateLinkage(), "comdat global value has private linkage",
-           GV);
-}
-
 void Verifier::visitModuleIdents(const Module &M) {
   const NamedMDNode *Idents = M.getNamedMetadata("llvm.ident");
   if (!Idents)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65686.213152.patch
Type: text/x-patch
Size: 1862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190803/7e6bab6f/attachment-0001.bin>


More information about the llvm-commits mailing list