[PATCH] D105374: [SimplifyCFG] simplifyUnreachable(): erase instructions iff they are guaranteed to transfer execution to unreachable

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 2 14:54:09 PDT 2021


nikic added inline comments.


================
Comment at: llvm/test/CodeGen/PowerPC/2007-11-16-landingpad-split.ll:86-87
                  catch i8* null
 	call void @llvm.stackrestore(i8* %tmp4)
         resume { i8*, i32 } %exn
 
----------------
lebedev.ri wrote:
> What happens here is that `call void @llvm.stackrestore()` ends up being located
> right before `unreachable`, and we now happily erase it.
> I think that makes sense, because `resume` would cause us to "return" from the function,
> freeing all the stack anyways.
This test is probably supposed to have a `cleanup` on the landingpad.

Speaking of, can someone point me to the relevant wording in LangRef/ExceptionHandling on why resuming from a non-cleanup landingpad is UB? At least that's how I understand the DwarfEHPrepare code.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105374/new/

https://reviews.llvm.org/D105374



More information about the llvm-commits mailing list