You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while analyzing the issue found that opt inlines D2 destructor into D0 destructor in a.ll (implicit instantiation), hence it contains only D0 function in D0 comdat whereas b.ll (explicit instantiation) contains all D0/D1/D2 destructors in D5 comdat.
In this IR with mixed comdats, D0 of a.ll is marked prevailing whereas D0 in b.ll is marked non-prevailing. As lld tries to remove D0 from b.ll and its COMDAT D5 (which is marked as non-prevailing because of D0), it marks D2 as available_externally, even though it is prevailing. Since D1 alias D2, which is not considered as real definition as its linkage type is available_externally, IR-Verifier pass throws the above-mentioned error.
Can we fix it similarly by not marking its comdat as non-prevailing, if the symbols name and comdat's name doesn't match? thereby leaving other symbols in comdat intact.
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 0f53c6085121..d66846756842 100644
--- a/llvm/lib/LTO/LTO.cpp+++ b/llvm/lib/LTO/LTO.cpp@@ -928,7 +928,7 @@ LTO::addRegularLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
// module (in linkRegularLTO), based on whether it is undefined.
Mod.Keep.push_back(GV);
GV->setLinkage(GlobalValue::AvailableExternallyLinkage);
- if (GV->hasComdat())+ if (GV->getComdat()->getName() == GV->getName())
NonPrevailingComdats.insert(GV->getComdat());
cast<GlobalObject>(GV)->setComdat(nullptr);
}
The text was updated successfully, but these errors were encountered:
when compiling the project ZenDNN with LLVM faced an error similar to that of given below
A simple test case demonstrating the issue:
and the C code reproducer:
while analyzing the issue found that opt inlines D2 destructor into D0 destructor in a.ll (implicit instantiation), hence it contains only D0 function in D0 comdat whereas b.ll (explicit instantiation) contains all D0/D1/D2 destructors in D5 comdat.
In this IR with mixed comdats, D0 of a.ll is marked prevailing whereas D0 in b.ll is marked non-prevailing. As lld tries to remove D0 from b.ll and its COMDAT D5 (which is marked as non-prevailing because of D0), it marks D2 as available_externally, even though it is prevailing. Since D1 alias D2, which is not considered as real definition as its linkage type is available_externally, IR-Verifier pass throws the above-mentioned error.
In thinLTO flow this issue not observed, it may be because of this commit [12050a3] (12050a3#diff-56a1bc22385a365b144c1ecc9d53128cb8f16dad12cc6f13b8ddf293a6c583b3) and its corresponding test case can be found at llvm/test/ThinLTO/X86/ctor-dtor-alias2.ll .
Can we fix it similarly by not marking its comdat as non-prevailing, if the symbols name and comdat's name doesn't match? thereby leaving other symbols in comdat intact.
The text was updated successfully, but these errors were encountered: