Revert "[ORC] Drop Comdat when discarding IR symbol"
authorJonas Hahnfeld <jonas.hahnfeld@cern.ch>
Sat, 4 Feb 2023 20:24:44 +0000 (21:24 +0100)
committerJonas Hahnfeld <jonas.hahnfeld@cern.ch>
Sat, 4 Feb 2023 20:26:36 +0000 (21:26 +0100)
A number of AArch64 bots report errors in clang-repl, for example
https://lab.llvm.org/buildbot/#/builders/197/builds/3920

This reverts commit 87d7838202267a011639fcbf97263556ccf091dc.

llvm/lib/ExecutionEngine/Orc/Layer.cpp
llvm/test/ExecutionEngine/Orc/Inputs/weak-comdat-def.ll [deleted file]
llvm/test/ExecutionEngine/Orc/weak-comdat.ll [deleted file]

index 3368d32..95380d9 100644 (file)
@@ -125,10 +125,6 @@ void IRMaterializationUnit::discard(const JITDylib &JD,
   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);
 }
 
diff --git a/llvm/test/ExecutionEngine/Orc/Inputs/weak-comdat-def.ll b/llvm/test/ExecutionEngine/Orc/Inputs/weak-comdat-def.ll
deleted file mode 100644 (file)
index d35ead0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-define i32 @g() {
-entry:
-  ret i32 0
-}
-
-$f = comdat nodeduplicate
-
-define i32 @f() comdat {
-entry:
-  %0 = call i32 @g()
-  ret i32 %0
-}
diff --git a/llvm/test/ExecutionEngine/Orc/weak-comdat.ll b/llvm/test/ExecutionEngine/Orc/weak-comdat.ll
deleted file mode 100644 (file)
index e1e1ab0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-; 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
-}