bool Changed = processUsedLDS(M);
for (Function &F : M.functions()) {
+ if (F.isDeclaration())
+ continue;
+
// Only lower compute kernels' LDS.
if (!AMDGPU::isKernel(F.getCallingConv()))
continue;
if (!F) {
IRBuilder<> Builder(Ctx);
SmallPtrSet<Function *, 32> Kernels;
- for (auto &I : M.functions()) {
- Function *Func = &I;
- if (AMDGPU::isKernelCC(Func) && !Kernels.contains(Func)) {
- markUsedByKernel(Builder, Func, SGV);
- Kernels.insert(Func);
+ for (Function &Func : M.functions()) {
+ if (Func.isDeclaration())
+ continue;
+
+ if (AMDGPU::isKernelCC(&Func) && !Kernels.contains(&Func)) {
+ markUsedByKernel(Builder, &Func, SGV);
+ Kernels.insert(&Func);
}
}
}