I think it would be nice if we could determine that functions cannot unwind (panic), in order to drop unnecessary landing pads. Something similar to the PruneEH pass in LLVM.
However, I'm not sure how to best do this within the query framework. Assuming for now that SCCs should always yield the conservative result, would it be fine to make use of the query cycle detection for that?
Not sure what SCCs are, but using the query cycle detector for anything but aborting compilation entirely is evil (I've been told).
The best I can come up with is to use the mir_optimized query and recurse on the MIR you get back (putting all the seen DefIds in a hashset to detect recursion and duplicate calls). This sadly doesn't scale well, because you're redoing the recursion detection on MIRs that you've done it before in another query
what SCCs are,
By previous context, I'd guess strongly connected component
Yeah, I meant strongly connected components. A lot of call graph oriented optimizations like to partition the cyclic call graph as an acyclic graph of SCCs, so that the acyclic (generally easy) and cyclic (generally hard) parts can be treated separately.
we have in general a need for being able to find SCCs of the callgraph; we need it for inlining too
there is SCC code in
just need to model the graph
I've chatted with @Wesley Wiser about doing this from time to time