[polly] 6aac277 - [polly][GPGPU] Fixup related to overloading exponent type in llvm.powi

Bjorn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 23:59:44 PDT 2021


Author: Bjorn Pettersson
Date: 2021-06-18T08:59:06+02:00
New Revision: 6aac2773d80b42bcf9da2414bbd410aa9f10095e

URL: https://github.com/llvm/llvm-project/commit/6aac2773d80b42bcf9da2414bbd410aa9f10095e
DIFF: https://github.com/llvm/llvm-project/commit/6aac2773d80b42bcf9da2414bbd410aa9f10095e.diff

LOG: [polly][GPGPU] Fixup related to overloading exponent type in llvm.powi

Commit 4c7f820b2b206bb changed the llvm.powi intrinsic to support
different 'int' sizes for the exponent. That happened to break
the IntrinsicToLibdeviceFunc mapping in PPCGCodeGeneration, which
obviously should have been updated as part of commit 4c7f820b2b
(https://reviews.llvm.org/D99439).

The shortcoming was found by buildbots that use
   -DPOLLY_ENABLE_GPGPU_CODEGEN=ON

This patch should fixup the problem.

Added: 
    

Modified: 
    polly/lib/CodeGen/PPCGCodeGeneration.cpp
    polly/test/GPGPU/libdevice-functions-copied-into-kernel.ll

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index 39f320af2d92c..dac1fcdd16426 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -1415,8 +1415,8 @@ const std::set<std::string> CUDALibDeviceFunctions = {
 const std::map<std::string, std::string> IntrinsicToLibdeviceFunc = {
     {"llvm.exp.f64", "exp"},
     {"llvm.exp.f32", "expf"},
-    {"llvm.powi.f64", "powi"},
-    {"llvm.powi.f32", "powif"}};
+    {"llvm.powi.f64.i32", "powi"},
+    {"llvm.powi.f32.i32", "powif"}};
 
 /// Return the corresponding CUDA libdevice function name @p Name.
 /// Note that this function will try to convert instrinsics in the list

diff  --git a/polly/test/GPGPU/libdevice-functions-copied-into-kernel.ll b/polly/test/GPGPU/libdevice-functions-copied-into-kernel.ll
index 62fc6badb30b1..194cb6c390240 100644
--- a/polly/test/GPGPU/libdevice-functions-copied-into-kernel.ll
+++ b/polly/test/GPGPU/libdevice-functions-copied-into-kernel.ll
@@ -65,7 +65,7 @@ for.body:                                         ; preds = %for.body.lr.ph, %fo
   %expf = tail call float @expf(float %A.arr.i.val)
   %cosf = tail call float @cosf(float %expf)
   %logf = tail call float @logf(float %cosf)
-  %powi = tail call float @llvm.powi.f32(float %logf, i32 2)
+  %powi = tail call float @llvm.powi.f32.i32(float %logf, i32 2)
   %exp = tail call float @llvm.exp.f32(float %powi)
   %B.arr.i = getelementptr inbounds float, float* %B, i64 %indvars.iv
   store float %exp, float* %B.arr.i, align 4
@@ -86,7 +86,7 @@ for.end:                                          ; preds = %for.cond.for.end_cr
 declare float @expf(float) #0
 declare float @cosf(float) #0
 declare float @logf(float) #0
-declare float @llvm.powi.f32(float, i32) #0
+declare float @llvm.powi.f32.i32(float, i32) #0
 declare float @llvm.exp.f32(float) #0
 
 attributes #0 = { nounwind readnone }


        


More information about the llvm-commits mailing list