[PATCH] D24682: [PR30341] Alias must point to a definition
Aditya Kumar via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 16 13:05:18 PDT 2016
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24682.71692.patch
Type: text/x-patch
Size: 1175 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160916/70844ea7/attachment.bin>
More information about the cfe-commits
mailing list