RFC: throw2goto exception optimization

Hello again LLVM devs,

Here’s the request for comments on the throw2goto exception optimization project. (This is my first one, I don’t know who gives out the official numbers for proposals :))

throw2goto-may20.pdf (221 KB)

(re: official proposal numbers: there are none)

What sort of feedback are you looking for on this? It doesn’t seem to be a proposal (at least in the way that they usually appear/are discussed in the LLVM community) - it sounds like "it’d be nice if compilers did " without any suggestion of how that might be achieved, or who would do the work to make that possible. Are you asking the LLVM community for approval for this direction so you can start contributing patches to implement it? Even that’s going to probably require some amount of suggestion about, broadly, how this would be implemented - to get a better understanding of the cost/benefit - how invasive such a change would be, etc.

  • Dave

Yes I’m looking for either community approval or reasons I might be barking up the wrong tree :slight_smile: Maybe someone else explored this idea and there’s some big roadblock. I would like to contribute myself, and there may be others like Emil who want to help. I just wanted to let you all know what I want to optimize since I’ve never contributed to clang before (sorry I don’t have better ideas on implementation strategy yet being unfamiliar with the codebase.)

Yes I’m looking for either community approval or reasons I might be barking up the wrong tree :slight_smile: Maybe someone else explored this idea and there’s some big roadblock. I would like to contribute myself, and there may be others like Emil who want to help. I just wanted to let you all know what I want to optimize since I’ve never contributed to clang before (sorry I don’t have better ideas on implementation strategy yet being unfamiliar with the codebase.)

Fair enough - Richard Smith might be able to chime in with some more perspective here. Guessing it’ll come down to probably doing a fair amount of work out of tree to demonstrate/figure out the structure/impact/etc & maybe some sense of benefit to see if it’s worth adding whatever the complexity is to the compiler.

Sounds good, thanks for the feedback. I was hoping it would just be a new pass. :slight_smile: (Arthur found the paragraph on g() calling std::terminate() is incorrect, that needs to be rewritten when I understand the EH mechanisms better.)

Sounds good, thanks for the feedback. I was hoping it would just be a new pass. :slight_smile:

/maybe/ - certainly worth a shot, but I’d guess it might be difficult to prove down in LLVM (the IR may not have carried enough semantic information with it to make the transformation valid in all cases) without plumbing through more information from the front end. Certainly a place to start/make a first attempt, in any case.