summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorErich Keane <erich.keane@intel.com>2018-12-07 15:31:23 +0000
committerErich Keane <erich.keane@intel.com>2018-12-07 15:31:23 +0000
commit248ed074199e4aa65c706a11033de88da883856d (patch)
treeb469d946d926873c8cfe8f98f76f4ce095443f62 /clang/lib/CodeGen/CodeGenModule.cpp
parent08e565c6f989de2718cb7653f3efcb9863099521 (diff)
downloadbcm5719-llvm-248ed074199e4aa65c706a11033de88da883856d.tar.gz
bcm5719-llvm-248ed074199e4aa65c706a11033de88da883856d.zip
Make CPUDispatch resolver emit dependent functions.
Inline cpu_specific versions referenced before the cpu_dispatch function weren't properly emitted, since they hadn't been referred to. This patch ensures that during resolver generation that all appropriate versions are emitted. Change-Id: I94c3766aaf9c75ca07a0ad8258efdbb834654ff8 llvm-svn: 348600
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 81304493a3a..b80a43b7eb2 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -2585,11 +2585,22 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) {
llvm::Constant *Func = GetGlobalValue(MangledName);
- if (!Func)
+ if (!Func) {
+ GlobalDecl ExistingDecl = Manglings.lookup(MangledName);
+ if (ExistingDecl.getDecl() &&
+ ExistingDecl.getDecl()->getAsFunction()->isDefined()) {
+ EmitGlobalFunctionDefinition(ExistingDecl, nullptr);
+ Func = GetGlobalValue(MangledName);
+ } else {
+ if (!ExistingDecl.getDecl())
+ ExistingDecl = GD.getWithMultiVersionIndex(Index);
+
Func = GetOrCreateLLVMFunction(
- MangledName, DeclTy, GD.getWithMultiVersionIndex(Index),
+ MangledName, DeclTy, ExistingDecl,
/*ForVTable=*/false, /*DontDefer=*/true,
/*IsThunk=*/false, llvm::AttributeList(), ForDefinition);
+ }
+ }
llvm::SmallVector<StringRef, 32> Features;
Target.getCPUSpecificCPUDispatchFeatures(II->getName(), Features);
OpenPOWER on IntegriCloud