[polly] r311648 - [Polly] [PPCGCodeGeneration] Mild refactoring of checking validity of functions in a kernel.
Siddharth Bhat via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 24 02:54:15 PDT 2017
Author: bollu
Date: Thu Aug 24 02:54:15 2017
New Revision: 311648
URL: http://llvm.org/viewvc/llvm-project?rev=311648&view=rev
Log:
[Polly] [PPCGCodeGeneration] Mild refactoring of checking validity of functions in a kernel.
This is a stylistic change to make the function a little more readable.
Also add a debug print to show what instruction contains a use of a
function we don't understand in the kernel.
Differential Revision: https://reviews.llvm.org/D37058
Modified:
polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
Modified: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp?rev=311648&r1=311647&r2=311648&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp Thu Aug 24 02:54:15 2017
@@ -3338,17 +3338,18 @@ public:
for (const Instruction &Inst : *BB) {
const CallInst *Call = dyn_cast<CallInst>(&Inst);
if (Call && isValidFunctionInKernel(Call->getCalledFunction(),
- AllowCUDALibDevice)) {
+ AllowCUDALibDevice))
continue;
- }
- for (Value *SrcVal : Inst.operands()) {
- PointerType *p = dyn_cast<PointerType>(SrcVal->getType());
- if (!p)
- continue;
- if (isa<FunctionType>(p->getElementType()))
- return true;
- }
+ 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->getElementType())) {
+ DEBUG(dbgs() << Inst
+ << " has illegal use of function in kernel.\n");
+ return true;
+ }
+ }
}
return false;
}
More information about the llvm-commits
mailing list