[llvm] r368094 - IR: Disable verifier check for GlobalValues with private linkage named after a comdat for non-COFF.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 14:47:18 PDT 2019
Author: pcc
Date: Tue Aug 6 14:47:18 2019
New Revision: 368094
URL: http://llvm.org/viewvc/llvm-project?rev=368094&view=rev
Log:
IR: Disable verifier check for GlobalValues with private linkage named after a comdat for non-COFF.
This check is only meaningful for COFF and it is perfectly valid to create
such a GlobalValue in ELF.
Differential Revision: https://reviews.llvm.org/D65686
Modified:
llvm/trunk/lib/IR/Verifier.cpp
llvm/trunk/test/Verifier/comdat2.ll
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=368094&r1=368093&r2=368094&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Tue Aug 6 14:47:18 2019
@@ -119,6 +119,7 @@ struct VerifierSupport {
raw_ostream *OS;
const Module &M;
ModuleSlotTracker MST;
+ Triple TT;
const DataLayout &DL;
LLVMContext &Context;
@@ -130,7 +131,8 @@ struct VerifierSupport {
bool TreatBrokenDebugInfoAsError = true;
explicit VerifierSupport(raw_ostream *OS, const Module &M)
- : OS(OS), M(M), MST(&M), DL(M.getDataLayout()), Context(M.getContext()) {}
+ : OS(OS), M(M), MST(&M), TT(M.getTargetTriple()), DL(M.getDataLayout()),
+ Context(M.getContext()) {}
private:
void Write(const Module *M) {
@@ -1306,11 +1308,12 @@ void Verifier::visitDIImportedEntity(con
}
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);
+ // In COFF the Module is invalid if the GlobalValue has private linkage.
+ // Entities with private linkage don't have entries in the symbol table.
+ if (TT.isOSBinFormatCOFF())
+ if (const GlobalValue *GV = M.getNamedValue(C.getName()))
+ Assert(!GV->hasPrivateLinkage(),
+ "comdat global value has private linkage", GV);
}
void Verifier::visitModuleIdents(const Module &M) {
Modified: llvm/trunk/test/Verifier/comdat2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/comdat2.ll?rev=368094&r1=368093&r2=368094&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/comdat2.ll (original)
+++ llvm/trunk/test/Verifier/comdat2.ll Tue Aug 6 14:47:18 2019
@@ -1,4 +1,6 @@
-; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: llvm-as %s -o /dev/null
+; RUN: opt -mtriple=x86_64-unknown-linux -o /dev/null
+; RUN: not opt -mtriple=x86_64-pc-win32 %s -o /dev/null 2>&1 | FileCheck %s
$v = comdat any
@v = private global i32 0, comdat($v)
More information about the llvm-commits
mailing list