r345839 - Multiversioning- Ensure all MV functions are emitted.
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 1 08:11:43 PDT 2018
Author: erichkeane
Date: Thu Nov 1 08:11:43 2018
New Revision: 345839
URL: http://llvm.org/viewvc/llvm-project?rev=345839&view=rev
Log:
Multiversioning- Ensure all MV functions are emitted.
Multiverson function versions are always used (by the resolver), so ensure that
they are always emitted.
Change-Id: I5d2e0841fddf0d18918b3fb92ae76814add7ee96
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/CodeGen/attr-target-mv.c
cfe/trunk/test/CodeGenCXX/attr-cpuspecific.cpp
cfe/trunk/test/CodeGenCXX/attr-target-mv-member-funcs.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=345839&r1=345838&r2=345839&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Thu Nov 1 08:11:43 2018
@@ -9773,6 +9773,10 @@ bool ASTContext::DeclMustBeEmitted(const
return true;
if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
+ // Multiversioned functions always have to be emitted, because they are used
+ // by the resolver.
+ if (FD->isMultiVersion())
+ return true;
// Forward declarations aren't required.
if (!FD->doesThisDeclarationHaveABody())
return FD->doesDeclarationForceExternallyVisibleDefinition();
Modified: cfe/trunk/test/CodeGen/attr-target-mv.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/attr-target-mv.c?rev=345839&r1=345838&r2=345839&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/attr-target-mv.c (original)
+++ cfe/trunk/test/CodeGen/attr-target-mv.c Thu Nov 1 08:11:43 2018
@@ -72,6 +72,16 @@ void bar4() {
// WINDOWS: call i32 @foo.sse4.2
// WINDOWS: call i32 @foo
+// LINUX: define linkonce i32 @foo_inline.arch_ivybridge()
+// LINUX: ret i32 1
+// LINUX: define linkonce i32 @foo_inline()
+// LINUX: ret i32 2
+
+// WINDOWS: define linkonce_odr dso_local i32 @foo_inline.arch_ivybridge()
+// WINDOWS: ret i32 1
+// WINDOWS: define linkonce_odr dso_local i32 @foo_inline()
+// WINDOWS: ret i32 2
+
// LINUX: define i32 @bar2()
// LINUX: call i32 @foo_inline.ifunc()
@@ -106,6 +116,22 @@ void bar4() {
// WINDOWS: call void @foo_decls.sse4.2
// Windows: call void @foo_decls
+// LINUX: define linkonce void @foo_decls()
+// LINUX: define linkonce void @foo_decls.sse4.2()
+
+// WINDOWS: define linkonce_odr dso_local void @foo_decls()
+// WINDOWS: define linkonce_odr dso_local void @foo_decls.sse4.2()
+
+// LINUX: define linkonce void @foo_multi(i32 %{{[^,]+}}, double %{{[^\)]+}})
+// LINUX: define linkonce void @foo_multi.avx_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
+// LINUX: define linkonce void @foo_multi.fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
+// LINUX: define linkonce void @foo_multi.arch_ivybridge_fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
+
+// WINDOWS: define linkonce_odr dso_local void @foo_multi(i32 %{{[^,]+}}, double %{{[^\)]+}})
+// WINDOWS: define linkonce_odr dso_local void @foo_multi.avx_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
+// WINDOWS: define linkonce_odr dso_local void @foo_multi.fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
+// WINDOWS: define linkonce_odr dso_local void @foo_multi.arch_ivybridge_fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
+
// LINUX: define void @bar4()
// LINUX: call void @foo_multi.ifunc(i32 1, double 5.{{[0+e]*}})
@@ -156,26 +182,3 @@ void bar4() {
// WINDOWS: declare dso_local i32 @foo_inline.arch_sandybridge()
-// LINUX: define linkonce i32 @foo_inline.arch_ivybridge()
-// LINUX: ret i32 1
-// LINUX: define linkonce i32 @foo_inline()
-// LINUX: ret i32 2
-
-// WINDOWS: define linkonce_odr dso_local i32 @foo_inline.arch_ivybridge()
-// WINDOWS: ret i32 1
-// WINDOWS: define linkonce_odr dso_local i32 @foo_inline()
-// WINDOWS: ret i32 2
-
-// LINUX: define linkonce void @foo_decls()
-// LINUX: define linkonce void @foo_decls.sse4.2()
-
-// WINDOWS: define linkonce_odr dso_local void @foo_decls()
-// WINDOWS: define linkonce_odr dso_local void @foo_decls.sse4.2()
-
-// LINUX: define linkonce void @foo_multi.avx_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
-// LINUX: define linkonce void @foo_multi.fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
-// LINUX: define linkonce void @foo_multi.arch_ivybridge_fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
-
-// WINDOWS: define linkonce_odr dso_local void @foo_multi.avx_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
-// WINDOWS: define linkonce_odr dso_local void @foo_multi.fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
-// WINDOWS: define linkonce_odr dso_local void @foo_multi.arch_ivybridge_fma4_sse4.2(i32 %{{[^,]+}}, double %{{[^\)]+}})
Modified: cfe/trunk/test/CodeGenCXX/attr-cpuspecific.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/attr-cpuspecific.cpp?rev=345839&r1=345838&r2=345839&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/attr-cpuspecific.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/attr-cpuspecific.cpp Thu Nov 1 08:11:43 2018
@@ -13,11 +13,13 @@ void foo() {
s.Func();
}
+
+// LINUX: define linkonce_odr void @_ZN1S4FuncEv.O
// LINUX: define void (%struct.S*)* @_ZN1S4FuncEv.resolver
// LINUX: ret void (%struct.S*)* @_ZN1S4FuncEv.S
// LINUX: ret void (%struct.S*)* @_ZN1S4FuncEv.O
+// WINDOWS: define linkonce_odr dso_local void @"?Func at S@@QEAAXXZ.O"
// WINDOWS: define dso_local void @"?Func at S@@QEAAXXZ"(%struct.S*)
// WINDOWS: musttail call void @"?Func at S@@QEAAXXZ.S"(%struct.S* %0)
// WINDOWS: musttail call void @"?Func at S@@QEAAXXZ.O"(%struct.S* %0)
-
Modified: cfe/trunk/test/CodeGenCXX/attr-target-mv-member-funcs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/attr-target-mv-member-funcs.cpp?rev=345839&r1=345838&r2=345839&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/attr-target-mv-member-funcs.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/attr-target-mv-member-funcs.cpp Thu Nov 1 08:11:43 2018
@@ -73,6 +73,25 @@ int templ_use() {
// LINUX: @_ZN5templIiE3fooEi.ifunc = ifunc i32 (%struct.templ*, i32), i32 (%struct.templ*, i32)* ()* @_ZN5templIiE3fooEi.resolver
// LINUX: @_ZN5templIdE3fooEi.ifunc = ifunc i32 (%struct.templ.0*, i32), i32 (%struct.templ.0*, i32)* ()* @_ZN5templIdE3fooEi.resolver
+
+// LINUX: define linkonce_odr i32 @_ZN1S3fooEi.sse4.2(%struct.S* %this, i32)
+// LINUX: ret i32 0
+
+// WINDOWS: define linkonce_odr dso_local i32 @"?foo at S@@QEAAHH at Z.sse4.2"(%struct.S* %this, i32)
+// WINDOWS: ret i32 0
+
+// LINUX: define linkonce_odr i32 @_ZN1S3fooEi.arch_ivybridge(%struct.S* %this, i32)
+// LINUX: ret i32 1
+
+// WINDOWS: define linkonce_odr dso_local i32 @"?foo at S@@QEAAHH at Z.arch_ivybridge"(%struct.S* %this, i32)
+// WINDOWS: ret i32 1
+
+// LINUX: define linkonce_odr i32 @_ZN1S3fooEi(%struct.S* %this, i32)
+// LINUX: ret i32 2
+
+// WINDOWS: define linkonce_odr dso_local i32 @"?foo at S@@QEAAHH at Z"(%struct.S* %this, i32)
+// WINDOWS: ret i32 2
+
// LINUX: define i32 @_Z3barv()
// LINUX: %s = alloca %struct.S, align 1
// LINUX: %s2 = alloca %struct.S, align 1
@@ -177,44 +196,26 @@ int templ_use() {
// WINDOWS: call i32 @"?foo@?$templ at N@@QEAAHH at Z.sse4.2"
// WINDOWS: call i32 @"?foo@?$templ at N@@QEAAHH at Z"
-// LINUX: define linkonce_odr i32 @_ZN1S3fooEi.sse4.2(%struct.S* %this, i32)
-// LINUX: ret i32 0
-
-// WINDOWS: define linkonce_odr dso_local i32 @"?foo at S@@QEAAHH at Z.sse4.2"(%struct.S* %this, i32)
-// WINDOWS: ret i32 0
-
-// LINUX: declare i32 @_ZN1S3fooEi.arch_sandybridge(%struct.S*, i32)
-
-// WINDOWS: declare dso_local i32 @"?foo at S@@QEAAHH at Z.arch_sandybridge"(%struct.S*, i32)
-
-// LINUX: define linkonce_odr i32 @_ZN1S3fooEi.arch_ivybridge(%struct.S* %this, i32)
-// LINUX: ret i32 1
-
-// WINDOWS: define linkonce_odr dso_local i32 @"?foo at S@@QEAAHH at Z.arch_ivybridge"(%struct.S* %this, i32)
-// WINDOWS: ret i32 1
-
-// LINUX: define linkonce_odr i32 @_ZN1S3fooEi(%struct.S* %this, i32)
-// LINUX: ret i32 2
-
-// WINDOWS: define linkonce_odr dso_local i32 @"?foo at S@@QEAAHH at Z"(%struct.S* %this, i32)
-// WINDOWS: ret i32 2
-
// LINUX: define linkonce_odr i32 @_ZN5templIiE3fooEi.sse4.2
-// LINUX: declare i32 @_ZN5templIiE3fooEi.arch_sandybridge
// LINUX: define linkonce_odr i32 @_ZN5templIiE3fooEi.arch_ivybridge
// LINUX: define linkonce_odr i32 @_ZN5templIiE3fooEi
// WINDOWS: define linkonce_odr dso_local i32 @"?foo@?$templ at H@@QEAAHH at Z.sse4.2"
-// WINDOWS: declare dso_local i32 @"?foo@?$templ at H@@QEAAHH at Z.arch_sandybridge"
// WINDOWS: define linkonce_odr dso_local i32 @"?foo@?$templ at H@@QEAAHH at Z.arch_ivybridge"
// WINDOWS: define linkonce_odr dso_local i32 @"?foo@?$templ at H@@QEAAHH at Z"
// LINUX: define linkonce_odr i32 @_ZN5templIdE3fooEi.sse4.2
-// LINUX: declare i32 @_ZN5templIdE3fooEi.arch_sandybridge
// LINUX: define linkonce_odr i32 @_ZN5templIdE3fooEi.arch_ivybridge
// LINUX: define linkonce_odr i32 @_ZN5templIdE3fooEi
// WINDOWS: define linkonce_odr dso_local i32 @"?foo@?$templ at N@@QEAAHH at Z.sse4.2"
-// WINDOWS: declare dso_local i32 @"?foo@?$templ at N@@QEAAHH at Z.arch_sandybridge"
// WINDOWS: define linkonce_odr dso_local i32 @"?foo@?$templ at N@@QEAAHH at Z.arch_ivybridge"
// WINDOWS: define linkonce_odr dso_local i32 @"?foo@?$templ at N@@QEAAHH at Z"
+
+// LINUX: declare i32 @_ZN1S3fooEi.arch_sandybridge(%struct.S*, i32)
+// LINUX: declare i32 @_ZN5templIiE3fooEi.arch_sandybridge
+// LINUX: declare i32 @_ZN5templIdE3fooEi.arch_sandybridge
+
+// WINDOWS: declare dso_local i32 @"?foo at S@@QEAAHH at Z.arch_sandybridge"(%struct.S*, i32)
+// WINDOWS: declare dso_local i32 @"?foo@?$templ at H@@QEAAHH at Z.arch_sandybridge"
+// WINDOWS: declare dso_local i32 @"?foo@?$templ at N@@QEAAHH at Z.arch_sandybridge"
More information about the cfe-commits
mailing list