[llvm-dev] What's the difference between llvm `resume` instruction and `__cxa_rethrow`?

John McCall via llvm-dev llvm-dev at lists.llvm.org
Wed Dec 1 19:34:14 PST 2021


On 1 Dec 2021, at 22:00, chuanqi.xcq wrote:
> Hi John,
>
> Many thanks for your explanation of Exception Handling!
>
>>  So it depends on what’s in the ellipses, but I believe this code 
>> is invalid, and landing pads are not supposed to do a resume when 
>> they’ve said they’re going to catch.
>>
>> I assume the actual source code you’re processing doesn’t 
>> literally have a catch (...) { throw; }, and instead it calls some 
>> function that might do a throw;?
>
> I guess I didn't make things clear (or I misunderstood you). I think 
> the code I posted might be valid.

I mean that the generated IR is incorrect because, to correspond to that 
source code, it needs to be rethrowing within a catch body instead of 
simply resuming.  That’s what I thought you were asking about.

Frankly, I just assumed the structure of your generated coroutine body 
was correct, or correct enough to show the intent.

John.


More information about the llvm-dev mailing list