[AMDGPU] Fix uncaught changes made by AMDGPUPreloadKernelArgumentsPass (#154645)

#153975 added a new test,
`test/CodeGen/AMDGPU/disable-preload-kernargs.ll`, that triggers an
assertion under `LLVM_ENABLE_EXPENSIVE_CHECKS` complaining about not
invalidating analyses even when the Pass made changes. It was caused by
the fact that the Pass only invalidates the analyses when number of
explicit arguments is greater than zero, while it is possible that some
functions will be removed even when there isn't any explicit argument,
hence the missed invalidation.
This commit is contained in:
Min-Yih Hsu 2025-08-20 16:23:23 -07:00 committed by GitHub
parent ff5f396dac
commit db0eceaa8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -341,6 +341,7 @@ static bool markKernelArgsAsInreg(Module &M, const TargetMachine &TM) {
Changed |= NumPreloadedExplicitArgs > 0;
}
Changed |= !FunctionsToErase.empty();
// Erase cloned functions if we needed to update the kernel signature to
// support preloading hidden kernel arguments.
for (auto *F : FunctionsToErase)