[AMDGPU][GlobalIsel] ICE: unable to lower arguments: void (i32)
The following bitcode module triggers an internal compiler error for -global-isel -O1 in https://github.com/llvm/llvm-project/commit/f68ef5b4303de763ecf37fd57cbefc3891ee48c0.
Module: https://gist.github.com/mgcarrasco/7487ab0bcf8bbd7be854e1bcfe222bbf
Reproducer: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -O1 -global-isel module.ll
Stack trace:
#10 0x00007c5f0eaa638a reportTranslationError(llvm::MachineFunction&, llvm::OptimizationRemarkEmitter&, llvm::OptimizationRemarkMissed&) IRTranslator.cpp:0:0
#11 0x00007c5f0eacc9c1 llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/../lib/libLLVMGlobalISel.so.23.0git+0x1019c1)
#12 0x00007c5f1132633b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#13 0x00007c5f0fa50251 llvm::FPPassManager::runOnFunction(llvm::Function&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/libLLVMCore.so.23.0git+0x297251)
#14 0x00007c5f1007dc12 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) CallGraphSCCPass.cpp:0:0
#15 0x00007c5f0fa51250 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/libLLVMCore.so.23.0git+0x298250)
#16 0x000060cd9261d79a compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#17 0x000060cd92610b6c main (/COD/LATEST/trunk/bin/llc+0x11b6c)
Bug found by @ElliotBLabs.
@llvm/issue-subscribers-backend-amdgpu
Author: Manuel Carrasco (mgcarrasco)
Module: https://gist.github.com/mgcarrasco/7487ab0bcf8bbd7be854e1bcfe222bbf
Reproducer: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -O1 -global-isel module.ll
Stack trace:
#<!-- -->10 0x00007c5f0eaa638a reportTranslationError(llvm::MachineFunction&, llvm::OptimizationRemarkEmitter&, llvm::OptimizationRemarkMissed&) IRTranslator.cpp:0:0
#<!-- -->11 0x00007c5f0eacc9c1 llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/../lib/libLLVMGlobalISel.so.23.0git+0x1019c1)
#<!-- -->12 0x00007c5f1132633b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#<!-- -->13 0x00007c5f0fa50251 llvm::FPPassManager::runOnFunction(llvm::Function&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/libLLVMCore.so.23.0git+0x297251)
#<!-- -->14 0x00007c5f1007dc12 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) CallGraphSCCPass.cpp:0:0
#<!-- -->15 0x00007c5f0fa51250 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/libLLVMCore.so.23.0git+0x298250)
#<!-- -->16 0x000060cd9261d79a compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#<!-- -->17 0x000060cd92610b6c main (/COD/LATEST/trunk/bin/llc+0x11b6c)
Bug found by @ElliotBLabs.
For these issues, do we want to add "good first issue" tag to some of them? ICE might be good candidate.
For these issues, do we want to add "good first issue" tag to some of them? ICE might be good candidate.
Ty, it sounds good to me.
Hi!
This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
- Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
- Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
- Fix the issue locally. Be aware that LLVM's AI policy forbids the use of AI tools to fix good first issues since it squanders a learning opportunity. Using LLMs to search and learn is permitted, since the goal is learning.
- Run the test suite locally. Remember that the subdirectories under
test/create fine-grained testing targets, so you can e.g. usemake check-clang-astto only run Clang's AST tests. - Create a Git commit.
- Run
git clang-format HEAD~1to format your changes. - Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.
If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.
@llvm/issue-subscribers-good-first-issue
Author: Manuel Carrasco (mgcarrasco)
Module: https://gist.github.com/mgcarrasco/7487ab0bcf8bbd7be854e1bcfe222bbf
Reproducer: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -O1 -global-isel module.ll
Stack trace:
#<!-- -->10 0x00007c5f0eaa638a reportTranslationError(llvm::MachineFunction&, llvm::OptimizationRemarkEmitter&, llvm::OptimizationRemarkMissed&) IRTranslator.cpp:0:0
#<!-- -->11 0x00007c5f0eacc9c1 llvm::IRTranslator::runOnMachineFunction(llvm::MachineFunction&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/../lib/libLLVMGlobalISel.so.23.0git+0x1019c1)
#<!-- -->12 0x00007c5f1132633b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#<!-- -->13 0x00007c5f0fa50251 llvm::FPPassManager::runOnFunction(llvm::Function&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/libLLVMCore.so.23.0git+0x297251)
#<!-- -->14 0x00007c5f1007dc12 (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) CallGraphSCCPass.cpp:0:0
#<!-- -->15 0x00007c5f0fa51250 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/mnt/COW/2026-06-01/trunk_23.0-0/bin/../lib/libLLVMCore.so.23.0git+0x298250)
#<!-- -->16 0x000060cd9261d79a compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#<!-- -->17 0x000060cd92610b6c main (/COD/LATEST/trunk/bin/llc+0x11b6c)
Bug found by @ElliotBLabs.
For these issues, do we want to add "good first issue" tag to some of them? ICE might be good candidate.
Ty, it sounds good to me.
In that case, please also clean the assignees such that people know they are still available.
real bug, something is missing, "Preloading hidden arguments is not supported\n"
cc to keep you posted @CatherineMoore @kzhuravl
Hi, can I give this a try?
@maomao9-0 please do, thanks.
Since there's been a week without any updates, could I request this be assigned to me? @mgcarrasco @maomao9-0
Hi, I'm still working on it, I'll give an update (and I have some questions to ask) in a few hours time.
Oh I'm sorry, please go ahead.
The following bitcode module triggers an internal compiler error for
-global-isel -O1in f68ef5b.Module: https://gist.github.com/mgcarrasco/7487ab0bcf8bbd7be854e1bcfe222bbf Reproducer:
llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -O1 -global-isel module.ll
Better to use godbolt links on bug reports for the future. It's easier to check if an old issue still reproduces
Hi, this is my first time working on llvm, so over the last week, I familiarized myself with llc and GlobalIsel, focusing on the code related to AMDGPU in particular. I also looked at three related diffs https://github.com/llvm/llvm-project/pull/98861, https://github.com/llvm/llvm-project/pull/116759 and https://github.com/llvm/llvm-project/pull/130434.
However, I am still not very certain of the direction to proceed. From what I see, it does not look like a "bug", but rather a feature that is not implemented yet (as seen in the TODO comment lowerFormalArgumentsKernel of AMDGPUCallLowering). It seems that the path without global-isel option works fine, so I investigated that path and it looks like the preloading of kernel arguments happen in SISelLowering in the lowerFormalArgument as well (by calling allocatePreloadKernArgSGPRs)
Would it make sense to implement something similar for AMDGPUCallLowering? Or am I missing something and there is an actual bug that is not related to the TODO comment? Would appreciate any guidance from someone with more experience. Thank you :)
probably have to implement similar thing as SISelLowering in the lowerFormalArgument in AMDGPUCallLowering, should get similar result to sdag from global-isel instead of failing to compile
Ok that makes sense thank you 👍
Unfortunately, I still wasn’t able to make significant progress on this :(. @keshavvinayak01, if you’re still interested, I’d be happy to hand this over to you. If you’re open to it, I’d also love to work with you and understand how you would approach tackling this task. Thank you!
Yeah I can take over. As I go through this and work on a solution, you can communicate with me to share your findings/understand how I'm approaching this. (Find me on the LLVM discord).
cc @mgcarrasco