[llvm] r230051 - Verifier: Unused comdats might not have a corresponding GV
David Majnemer
david.majnemer at gmail.com
Fri Feb 20 11:58:49 PST 2015
Author: majnemer
Date: Fri Feb 20 13:58:48 2015
New Revision: 230051
URL: http://llvm.org/viewvc/llvm-project?rev=230051&view=rev
Log:
Verifier: Unused comdats might not have a corresponding GV
This fixes PR22646.
Added:
llvm/trunk/test/Verifier/comdat3.ll
Modified:
llvm/trunk/lib/IR/Verifier.cpp
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=230051&r1=230050&r2=230051&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Fri Feb 20 13:58:48 2015
@@ -793,16 +793,9 @@ void Verifier::visitMDImportedEntity(con
}
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);
}
Added: llvm/trunk/test/Verifier/comdat3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/comdat3.ll?rev=230051&view=auto
==============================================================================
--- llvm/trunk/test/Verifier/comdat3.ll (added)
+++ llvm/trunk/test/Verifier/comdat3.ll Fri Feb 20 13:58:48 2015
@@ -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
More information about the llvm-commits
mailing list