[polly] dbe6d85 - [PPCGCodeGeneration] Look for function instead of function pointer type

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 09:01:09 PDT 2022


Author: Nikita Popov
Date: 2022-04-19T17:59:34+02:00
New Revision: dbe6d85b8b245bd913e6f38425dc5e37cd610bfa

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

LOG: [PPCGCodeGeneration] Look for function instead of function pointer type

What this code is actually interested in are references to functions.
Use of a function pointer type is being used as an imprecise proxy
for that.

Added: 
    

Modified: 
    polly/lib/CodeGen/PPCGCodeGeneration.cpp

Removed: 
    


################################################################################
diff  --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
index c12e19c2895d7..111edc1b0ed88 100644
--- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp
+++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp
@@ -3443,13 +3443,11 @@ class PPCGCodeGeneration : public ScopPass {
         continue;
 
       for (Value *Op : Inst.operands())
-        // Look for (<func-type>*) among operands of Inst
-        if (auto PtrTy = dyn_cast<PointerType>(Op->getType())) {
-          if (isa<FunctionType>(PtrTy->getPointerElementType())) {
-            LLVM_DEBUG(dbgs()
-                       << Inst << " has illegal use of function in kernel.\n");
-            return true;
-          }
+        // Look for functions among operands of Inst.
+        if (isa<Function>(Op->stripPointerCasts())) {
+          LLVM_DEBUG(dbgs()
+                     << Inst << " has illegal use of function in kernel.\n");
+          return true;
         }
     }
     return false;


        


More information about the llvm-commits mailing list