[llvm] [AMDGPU] Avoid hitting AMDGPUAsmPrinter related asserts for local functions at O0 (PR #72129)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 13 17:23:19 PST 2023


arsenm wrote:

> Does this fix #64863? We can put it in the commit message if so to close it if this lands.

This is also part of #71594 

I've debugged this issue a few times and I'm not sure this is sufficient to fix every case. It also produces different behavior from other targets / when CodeGenInSCCOrder is not enabled. Namely, other targets will codegen and emit the code for the dead functions and here you're not emitting anything.

The problem isn't uncalled functions per-se, but functions which do not appear in the CallGraphSCC order. Functions which are only indirectly called still should report sensible register usage, but will also not necessarily codegen in the correct order. I had a patch which I believe did fix all cases by inserting a createBarrierNoopPass, such that all codegen was forced to happen prior to the AsmPrinter but this is a heavy hammer. Ideally the AsmPrinter wouldn't have any ordering dependencies.

I think the long term solution is to move the handling of the resource computation into MC. The assembler/linker should be able to resolve some kind of custom expression built in terms of referenced symbols 


https://github.com/llvm/llvm-project/pull/72129


More information about the llvm-commits mailing list