[polly] r310194 - [GPGPU] Rename all, not only the first libdevice function
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 5 20:04:15 PDT 2017
Author: grosser
Date: Sat Aug 5 20:04:15 2017
New Revision: 310194
URL: http://llvm.org/viewvc/llvm-project?rev=310194&view=rev
Log:
[GPGPU] Rename all, not only the first libdevice function
Modified:
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
polly/trunk/test/GPGPU/Inputs/libdevice-functions-copied-into-kernel_libdevice.ll
polly/trunk/test/GPGPU/libdevice-functions-copied-into-kernel.ll
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=310194&r1=310193&r2=310194&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Sat Aug 5 20:04:15 2017
@@ -2298,6 +2298,7 @@ std::string GPUNodeBuilder::createKernel
}
bool GPUNodeBuilder::requiresCUDALibDevice() {
+ bool RequiresLibDevice = false;
for (Function &F : GPUModule->functions()) {
if (!F.isDeclaration())
continue;
@@ -2305,11 +2306,11 @@ bool GPUNodeBuilder::requiresCUDALibDevi
std::string CUDALibDeviceFunc = getCUDALibDeviceFuntion(&F);
if (CUDALibDeviceFunc.length() != 0) {
F.setName(CUDALibDeviceFunc);
- return true;
+ RequiresLibDevice = true;
}
}
- return false;
+ return RequiresLibDevice;
}
void GPUNodeBuilder::addCUDALibDevice() {
Modified: polly/trunk/test/GPGPU/Inputs/libdevice-functions-copied-into-kernel_libdevice.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/GPGPU/Inputs/libdevice-functions-copied-into-kernel_libdevice.ll?rev=310194&r1=310193&r2=310194&view=diff
==============================================================================
--- polly/trunk/test/GPGPU/Inputs/libdevice-functions-copied-into-kernel_libdevice.ll (original)
+++ polly/trunk/test/GPGPU/Inputs/libdevice-functions-copied-into-kernel_libdevice.ll Sat Aug 5 20:04:15 2017
@@ -1,3 +1,6 @@
define float @__nv_expf(float %a) {
ret float %a
}
+define float @__nv_cosf(float %a) {
+ ret float %a
+}
Modified: polly/trunk/test/GPGPU/libdevice-functions-copied-into-kernel.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/GPGPU/libdevice-functions-copied-into-kernel.ll?rev=310194&r1=310193&r2=310194&view=diff
==============================================================================
--- polly/trunk/test/GPGPU/libdevice-functions-copied-into-kernel.ll (original)
+++ polly/trunk/test/GPGPU/libdevice-functions-copied-into-kernel.ll Sat Aug 5 20:04:15 2017
@@ -19,6 +19,7 @@
; Check that the intrinsic call is present in the kernel IR.
; KERNEL-IR: %p_expf = tail call float @__nv_expf(float %A.arr.i.val_p_scalar_)
+; KERNEL-IR: %p_cosf = tail call float @__nv_cosf(float %p_expf)
; Check that kernel launch is generated in host IR.
; the declare would not be generated unless a call to a kernel exists.
@@ -29,6 +30,7 @@
; for(int i = 0; i < N; i++) {
; float tmp0 = A[i];
; float tmp1 = expf(tmp1);
+; tmp1 = cosf(tmp1);
; B[i] = tmp1;
; }
; }
@@ -52,6 +54,7 @@ for.body:
%A.arr.i.val = load float, float* %A.arr.i, align 4
; Call to intrinsics that should be part of the kernel.
%expf = tail call float @expf(float %A.arr.i.val)
+ %cosf = tail call float @cosf(float %expf)
%B.arr.i = getelementptr inbounds float, float* %B, i64 %indvars.iv
store float %expf, float* %B.arr.i, align 4
@@ -69,6 +72,7 @@ for.end:
; Function Attrs: nounwind readnone
declare float @expf(float) #0
+declare float @cosf(float) #0
attributes #0 = { nounwind readnone }
More information about the llvm-commits
mailing list