assert(!I->second->isDeclaration() &&
"Discard should only apply to definitions");
I->second->setLinkage(GlobalValue::AvailableExternallyLinkage);
- // According to the IR verifier, "Declaration[s] may not be in a Comdat!"
- // Remove it, if this is a GlobalObject.
- if (auto *GO = dyn_cast<GlobalObject>(I->second))
- GO->setComdat(nullptr);
SymbolToDefinition.erase(I);
}
+++ /dev/null
-define i32 @g() {
-entry:
- ret i32 0
-}
-
-$f = comdat nodeduplicate
-
-define i32 @f() comdat {
-entry:
- %0 = call i32 @g()
- ret i32 %0
-}
+++ /dev/null
-; RUN: lli -extra-module %p/Inputs/weak-comdat-def.ll %s
-; UNSUPPORTED: target={{.*}}-darwin{{.*}}
-
-declare i32 @g()
-
-$f = comdat nodeduplicate
-
-define weak i32 @f() comdat {
-entry:
- %0 = call i32 @g()
- ret i32 %0
-}
-
-define i32 @main() {
-entry:
- %0 = call i32 @f()
- ret i32 %0
-}