Skip to content

Commit

Permalink
[Polly] [PPCGCodeGeneration] Mild refactoring of checking validity of…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
bollu committed Aug 24, 2017
1 parent d7eb619 commit 7802743
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions polly/lib/CodeGen/PPCGCodeGeneration.cpp
Expand Up @@ -3338,17 +3338,18 @@ class PPCGCodeGeneration : public ScopPass {
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;
}
Expand Down

0 comments on commit 7802743

Please sign in to comment.