[llvm] [Analysis] Visit orphan Functions in CGPassManager catch-up loop (PR #194219)
via llvm-commits
llvm-commits at lists.llvm.org
Sun May 3 02:38:49 PDT 2026
SjoerdNijboer wrote:
> Additionally, when I looked into this problem it was only an issue at O0 since O1 and up would remove the uncalled internal/private functions. Unless that has changed, should also mention that this is only problematic at O0.
I believe this can break at any point when CGSCCPass and another ModulePass is used in the backend.
With it really being a pass layout issue, I'm not sure if I can call it exclusive to O0 or O1 or higher optimizations levels.
The annoying part of this bug is that a few things have to come together to even make it have any non-silent effect at all, and one of them is the target microarchitecture.
While "technically" correct code is generated on say x86-64, when IPRA is enabled through an optimization option, it does silently omit these functions. LLVM could've gone years without having any adverse effect of that but due to RISC-V being a backend this bug surfaced.
The patch that I posted on the original LLVM repo was quite a hack which granted RISC-V an exception. Which (rightfully) got some push back for a proper fix. And the only fix that I could come up with that would be future proof was this architectural change where a whole bunch of code is changed with very minimal actual changes for x86-64, AMDGPU but with actual meaningful behavioural changes for ARM and RISC-V. I chose this specific approach since now later optimization passes all behave exactly thesame in this regardless of target architecture and optimization level. And I think that was honestly quite a bigger problem than anything else. If there's optimization passes that work for one target, but not for another when there is no meaningful difference, that'll stifle progress of LLVM by adding special cases.
https://github.com/llvm/llvm-project/pull/194219
More information about the llvm-commits
mailing list