1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

Verifier: Unused comdats might not have a corresponding GV

This fixes PR22646.

llvm-svn: 230051
This commit is contained in:
David Majnemer 2015-02-20 19:58:48 +00:00
parent dc11957da0
commit c4bcdfa1bc
2 changed files with 6 additions and 8 deletions

View File

@ -793,16 +793,9 @@ void Verifier::visitMDImportedEntity(const MDImportedEntity &N) {
}
void Verifier::visitComdat(const Comdat &C) {
// All Comdat::SelectionKind values other than Comdat::Any require a
// GlobalValue with the same name as the Comdat.
const GlobalValue *GV = M->getNamedValue(C.getName());
if (C.getSelectionKind() != Comdat::Any)
Assert1(GV,
"comdat selection kind requires a global value with the same name",
&C);
// The Module is invalid if the GlobalValue has private linkage. Entities
// with private linkage don't have entries in the symbol table.
if (GV)
if (const GlobalValue *GV = M->getNamedValue(C.getName()))
Assert1(!GV->hasPrivateLinkage(), "comdat global value has private linkage",
GV);
}

5
test/Verifier/comdat3.ll Normal file
View File

@ -0,0 +1,5 @@
; 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 largest