Skip to content

Conversation

@mshockwave
Copy link
Member

#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.

@llvmbot
Copy link
Member

llvmbot commented Aug 20, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Min-Yih Hsu (mshockwave)

Changes

#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.


Full diff: https://github.com/llvm/llvm-project/pull/154645.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp (+1)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp
index a386fe621a553..ffbbf63969427 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPreloadKernelArguments.cpp
@@ -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)

@mshockwave mshockwave merged commit db0ecea into llvm:main Aug 20, 2025
11 checks passed
@mshockwave mshockwave deleted the patch/amdgpu/fix-disable-preload-kernargs branch August 20, 2025 23:23
@shiltian
Copy link
Contributor

Thanks! @mshockwave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants