[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.
This commit is contained in:
Nikita Popov 2022-04-19 17:59:34 +02:00
parent 880014b593
commit dbe6d85b8b

View file

@ -3443,13 +3443,11 @@ public:
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;