Do not use '.' in subfunction names
Certain backends, e.g. NVPTX, do not support '.' in function names. Hence,
we ensure all '.' are replaced by '_' when generating function names for
subfunctions. For the current OpenMP code generation, this is not strictly
necessary, but future uses cases (e.g. GPU offloading) need this issue to be
fixed.
llvm-svn: 246980
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index beded43..16964b3 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -259,7 +259,13 @@
std::vector<Type *> Arguments(1, Builder.getInt8PtrTy());
FunctionType *FT = FunctionType::get(Builder.getVoidTy(), Arguments, false);
Function *SubFn = Function::Create(FT, Function::InternalLinkage,
- F->getName() + ".polly.subfn", M);
+ F->getName() + "_polly_subfn", M);
+
+ // Certain backends (e.g., NVPTX) do not support '.'s in function names.
+ // Hence, we ensure that all '.'s are replaced by '_'s.
+ std::string FunctionName = SubFn->getName();
+ std::replace(FunctionName.begin(), FunctionName.end(), '.', '_');
+ SubFn->setName(FunctionName);
// Do not run any polly pass on the new function.
SubFn->addFnAttr(PollySkipFnAttr);