diff options
author | Siddharth Bhat <siddu.druid@gmail.com> | 2017-08-24 09:54:15 +0000 |
---|---|---|
committer | Siddharth Bhat <siddu.druid@gmail.com> | 2017-08-24 09:54:15 +0000 |
commit | 78027437e6150666e7d04ffbef1d28131182044c (patch) | |
tree | 44883979b15715754303860b81173822dfa72505 /polly/lib/CodeGen/PPCGCodeGeneration.cpp | |
parent | d7eb61929929fcb5dae77f63a5d9d9be026eaeb8 (diff) | |
download | bcm5719-llvm-78027437e6150666e7d04ffbef1d28131182044c.tar.gz bcm5719-llvm-78027437e6150666e7d04ffbef1d28131182044c.zip |
[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
llvm-svn: 311648
Diffstat (limited to 'polly/lib/CodeGen/PPCGCodeGeneration.cpp')
-rw-r--r-- | polly/lib/CodeGen/PPCGCodeGeneration.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/polly/lib/CodeGen/PPCGCodeGeneration.cpp b/polly/lib/CodeGen/PPCGCodeGeneration.cpp index 41e1c9ecd0f..61c3fd0bc6c 100644 --- a/polly/lib/CodeGen/PPCGCodeGeneration.cpp +++ b/polly/lib/CodeGen/PPCGCodeGeneration.cpp @@ -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; } |