Stream: t-compiler

Topic: determine nounwind functions


Nikita Popov (Nov 05 2018 at 14:23, on Zulip):

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?

oli (Nov 05 2018 at 19:22, on Zulip):

Not sure what SCCs are, but using the query cycle detector for anything but aborting compilation entirely is evil (I've been told).

oli (Nov 05 2018 at 19:25, on Zulip):

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

Jake Goulding (Nov 05 2018 at 20:51, on Zulip):

what SCCs are,

By previous context, I'd guess strongly connected component

Nikita Popov (Nov 05 2018 at 21:11, on Zulip):

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.

nikomatsakis (Nov 12 2018 at 18:44, on Zulip):

we have in general a need for being able to find SCCs of the callgraph; we need it for inlining too

nikomatsakis (Nov 12 2018 at 18:44, on Zulip):

there is SCC code in rustc_data_structures

nikomatsakis (Nov 12 2018 at 18:45, on Zulip):

just need to model the graph

nikomatsakis (Nov 12 2018 at 18:45, on Zulip):

I've chatted with @Wesley Wiser about doing this from time to time

Last update: Nov 20 2019 at 01:20UTC