hiraditya created this revision. hiraditya added reviewers: rafael, eugenis. hiraditya added subscribers: sebpop, mclow.lists, cfe-commits, EricWF.
Inlining the destructor caused the compiler to generate bad IR which failed the Verifier in the backend. https://llvm.org/bugs/show_bug.cgi?id=30341 This patch disables alias to available_externally definitions. https://reviews.llvm.org/D24682 Files: clang/lib/CodeGen/CGCXX.cpp Index: clang/lib/CodeGen/CGCXX.cpp =================================================================== --- clang/lib/CodeGen/CGCXX.cpp +++ clang/lib/CodeGen/CGCXX.cpp @@ -134,6 +134,10 @@ llvm::GlobalValue::LinkageTypes TargetLinkage = getFunctionLinkage(TargetDecl); + // r254170: Disallow aliases to available_externally. + if (TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage) + return true; + // Check if we have it already. StringRef MangledName = getMangledName(AliasDecl); llvm::GlobalValue *Entry = GetGlobalValue(MangledName); @@ -157,8 +161,7 @@ // Instead of creating as alias to a linkonce_odr, replace all of the uses // of the aliasee. if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) && - (TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage || - !TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>())) { + !TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>()) { // FIXME: An extern template instantiation will create functions with // linkage "AvailableExternally". In libc++, some classes also define // members with attribute "AlwaysInline" and expect no reference to
Index: clang/lib/CodeGen/CGCXX.cpp =================================================================== --- clang/lib/CodeGen/CGCXX.cpp +++ clang/lib/CodeGen/CGCXX.cpp @@ -134,6 +134,10 @@ llvm::GlobalValue::LinkageTypes TargetLinkage = getFunctionLinkage(TargetDecl); + // r254170: Disallow aliases to available_externally. + if (TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage) + return true; + // Check if we have it already. StringRef MangledName = getMangledName(AliasDecl); llvm::GlobalValue *Entry = GetGlobalValue(MangledName); @@ -157,8 +161,7 @@ // Instead of creating as alias to a linkonce_odr, replace all of the uses // of the aliasee. if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) && - (TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage || - !TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>())) { + !TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>()) { // FIXME: An extern template instantiation will create functions with // linkage "AvailableExternally". In libc++, some classes also define // members with attribute "AlwaysInline" and expect no reference to
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits