This introduces a noreadafterunwind attribute, which is intended to allow additional optimizations in DSE and MemCpyOpt. The simplest example is:
declare void @may_unwind() define void @test(i32* noalias noreadafterunwind sret(i32) %out) { store i32 0, i32* %out call void @may_unwind() store i32 1, i32* %out ret void }
Without the noreadafterunwind attribute, we can not eliminate the first store, because the call might unwind, and the caller may observe the state after the first store.
The attribute is currently defined in a way that does not make a read after unwind immediate UB and just makes it return poison instead. I'm open to making it immediate UB though, I don't think there's a lot of practical difference either way.
Frontends will likely want to annotate sret parameters with noreadafterunwind.
See https://lists.llvm.org/pipermail/llvm-dev/2021-December/154164.html for preliminary discussion on this.