[AMDGPU] Avoid processing functions in amdgpu-propagate-attributes pass for shaders

The pass amdgpu-propagate-attributes ("Early/Late propagate attributes
from kernels to functions") is currently run also for shaders, where
it does nothing. Modify the check so the pass only processes functions
for kernels.

Differential Revision: https://reviews.llvm.org/D109961
This commit is contained in:
Piotr Sobczak 2021-09-17 14:12:23 +02:00
parent 3778c1cd6e
commit 2ac53fffae
1 changed files with 4 additions and 5 deletions

View File

@ -212,10 +212,10 @@ AMDGPUPropagateAttributes::findFunction(const FnProperties &PropsNeeded,
bool AMDGPUPropagateAttributes::process(Module &M) {
for (auto &F : M.functions())
if (AMDGPU::isEntryFunctionCC(F.getCallingConv()))
if (AMDGPU::isKernel(F.getCallingConv()))
Roots.insert(&F);
return process();
return Roots.empty() ? false : process();
}
bool AMDGPUPropagateAttributes::process(Function &F) {
@ -228,8 +228,7 @@ bool AMDGPUPropagateAttributes::process() {
SmallSet<Function *, 32> NewRoots;
SmallSet<Function *, 32> Replaced;
if (Roots.empty())
return false;
assert(!Roots.empty());
Module &M = *(*Roots.begin())->getParent();
do {
@ -383,7 +382,7 @@ bool AMDGPUPropagateAttributesEarly::runOnFunction(Function &F) {
TM = &TPC->getTM<TargetMachine>();
}
if (!AMDGPU::isEntryFunctionCC(F.getCallingConv()))
if (!AMDGPU::isKernel(F.getCallingConv()))
return false;
return AMDGPUPropagateAttributes(TM, false).process(F);