Index: polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp =================================================================== --- polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp +++ polly/trunk/lib/CodeGen/PPCGCodeGeneration.cpp @@ -3338,17 +3338,18 @@ for (const Instruction &Inst : *BB) { const CallInst *Call = dyn_cast(&Inst); if (Call && isValidFunctionInKernel(Call->getCalledFunction(), - AllowCUDALibDevice)) { + AllowCUDALibDevice)) continue; - } - for (Value *SrcVal : Inst.operands()) { - PointerType *p = dyn_cast(SrcVal->getType()); - if (!p) - continue; - if (isa(p->getElementType())) - return true; - } + for (Value *Op : Inst.operands()) + // Look for (*) among operands of Inst + if (auto PtrTy = dyn_cast(Op->getType())) { + if (isa(PtrTy->getElementType())) { + DEBUG(dbgs() << Inst + << " has illegal use of function in kernel.\n"); + return true; + } + } } return false; }