diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2019-06-18 20:29:06 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-06-18 20:29:06 +0000 |
| commit | 9f3a805ee96b70ebe384ea6337c49464b5f28af2 (patch) | |
| tree | 3253343863b9e09f3cd372b8e03b5c88f8e9ee50 /clang/lib/AST | |
| parent | ba43840bfe2ea9e7a528d0a99d6a4d07d376567d (diff) | |
| download | bcm5719-llvm-9f3a805ee96b70ebe384ea6337c49464b5f28af2.tar.gz bcm5719-llvm-9f3a805ee96b70ebe384ea6337c49464b5f28af2.zip | |
[OPENMP]Use host's mangling for 128 bit float types on the device.
Device have to use the same mangling as the host for 128bit float types. Otherwise, the codegen for the device is unable to find the parent function when it tries to generate the outlined function for the target region and it leads to incorrect compilation and crash at the runtime.
llvm-svn: 363734
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ItaniumMangle.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index 4fe3bfe6561..031aac0dbee 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -2607,17 +2607,33 @@ void CXXNameMangler::mangleType(const BuiltinType *T) { case BuiltinType::Double: Out << 'd'; break; - case BuiltinType::LongDouble: - Out << (getASTContext().getTargetInfo().useFloat128ManglingForLongDouble() - ? 'g' - : 'e'); + case BuiltinType::LongDouble: { + bool UseFloat128Mangling = + getASTContext().getTargetInfo().useFloat128ManglingForLongDouble(); + if (getASTContext().getLangOpts().OpenMP && + getASTContext().getLangOpts().OpenMPIsDevice) { + UseFloat128Mangling = getASTContext() + .getAuxTargetInfo() + ->useFloat128ManglingForLongDouble(); + } + Out << (UseFloat128Mangling ? 'g' : 'e'); break; - case BuiltinType::Float128: - if (getASTContext().getTargetInfo().useFloat128ManglingForLongDouble()) + } + case BuiltinType::Float128: { + bool UseFloat128Mangling = + getASTContext().getTargetInfo().useFloat128ManglingForLongDouble(); + if (getASTContext().getLangOpts().OpenMP && + getASTContext().getLangOpts().OpenMPIsDevice) { + UseFloat128Mangling = getASTContext() + .getAuxTargetInfo() + ->useFloat128ManglingForLongDouble(); + } + if (UseFloat128Mangling) Out << "U10__float128"; // Match the GCC mangling else Out << 'g'; break; + } case BuiltinType::NullPtr: Out << "Dn"; break; |

