diff options
author | Erich Keane <erich.keane@intel.com> | 2018-12-07 15:31:23 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-12-07 15:31:23 +0000 |
commit | 248ed074199e4aa65c706a11033de88da883856d (patch) | |
tree | b469d946d926873c8cfe8f98f76f4ce095443f62 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 08e565c6f989de2718cb7653f3efcb9863099521 (diff) | |
download | bcm5719-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.cpp | 15 |
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); |