[PATCH] D48070: [Polly] Simplify the implementation of getCUDALibDeviceFunction. NFC.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 14 01:59:28 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL334695: Simplify the implementation of getCUDALibDeviceFunction. NFC. (authored by pfaffe, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D48070
Files:
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
Index: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
===================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1398,26 +1398,22 @@
{"llvm.powi.f64", "powi"},
{"llvm.powi.f32", "powif"}};
-/// Return the corresponding CUDA libdevice function name for @p F.
+/// Return the corresponding CUDA libdevice function name @p Name.
/// Note that this function will try to convert instrinsics in the list
/// IntrinsicToLibdeviceFunc into libdevice functions.
/// This is because some intrinsics such as `exp`
/// are not supported by the NVPTX backend.
/// If this restriction of the backend is lifted, we should refactor our code
/// so that we use intrinsics whenever possible.
///
/// Return "" if we are not compiling for CUDA.
-std::string getCUDALibDeviceFuntion(Function *F) {
- auto FnName = [&]() -> const std::string {
- auto It = IntrinsicToLibdeviceFunc.find(F->getName());
- if (It != IntrinsicToLibdeviceFunc.end())
- return It->second;
+std::string getCUDALibDeviceFuntion(StringRef Name) {
+ auto It = IntrinsicToLibdeviceFunc.find(Name);
+ if (It != IntrinsicToLibdeviceFunc.end())
+ return getCUDALibDeviceFuntion(It->second);
- return std::string(F->getName());
- }();
-
- if (CUDALibDeviceFunctions.count(FnName))
- return "__nv_" + FnName;
+ if (CUDALibDeviceFunctions.count(Name))
+ return ("__nv_" + Name).str();
return "";
}
@@ -1430,7 +1426,7 @@
// "llvm.copysign".
const StringRef Name = F->getName();
- if (AllowLibDevice && getCUDALibDeviceFuntion(F).length() > 0)
+ if (AllowLibDevice && getCUDALibDeviceFuntion(Name).length() > 0)
return true;
return F->isIntrinsic() &&
@@ -2389,7 +2385,7 @@
if (!F.isDeclaration())
continue;
- const std::string CUDALibDeviceFunc = getCUDALibDeviceFuntion(&F);
+ const std::string CUDALibDeviceFunc = getCUDALibDeviceFuntion(F.getName());
if (CUDALibDeviceFunc.length() != 0) {
// We need to handle the case where a module looks like this:
// @expf(..)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48070.151310.patch
Type: text/x-patch
Size: 2143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180614/1c758182/attachment.bin>
More information about the llvm-commits
mailing list