New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure removing dead function due to RefSCC cycle #56503
Comments
cc @aeubanks |
@alinas |
From reading some of the commit logs here, it seemed like the choice to not perform updates around ref edges was deliberate (e.g., this change) which was why for my workaround I tried to handle the case when deleting the function rather than triggering updates as part of argument promotion. But yes, understanding if we should be doing something to break the cycle when we perform argument promotion is a key question. I also don't know if there are other optimizations (in addition to argument promotion) that may cause ref edges to become dead as well. |
I didn't know dead ref edges were allowed to be kept around, that's good to know and we should document that better in comments. Argument promotion should be the only CGSCC pass that modifies callers, which is how dead ref edges appear. Your patch looks mostly good, but we need to handle the result of Feel free to put up a patch and add me as a reviewer. |
sent out https://reviews.llvm.org/D133907 since we hit this after https://reviews.llvm.org/D128830 |
I saw a crash when compiling rust code. When I enabled LLVM assertions I saw the following assert fire:
llvm/lib/Analysis/LazyCallGraph.cpp:1538: void llvm::LazyCallGraph::removeDeadFunction(llvm::Function&): Assertion `RC.size() == 1 && "Dead functions must be in a singular RefSCC"' failed.
From looking further, the code appears to trigger the following sequence of events:
From this I was able to construct the following example to trigger the assertion under
opt --passes=argpromotion,inline
With the following backtrace:
I also verified that adding code to explicitly break the cycles when we hit the case of deleting such a function appears to work for both this example and the original Rust code, but this might not be the best solution (although other work to try and avoid getting into this situation may affect throughput). Happy to put out a review if this is the right direction or to validate other possible fixes with my repro case.
The text was updated successfully, but these errors were encountered: