[PATCH] D156476: [IR] Mark `llvm.trap` as `memory(inaccessiblemem: write)`

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 27 12:32:28 PDT 2023


jdoerfert added a comment.

In D156476#4540070 <https://reviews.llvm.org/D156476#4540070>, @nikic wrote:

> Making it inaccessible mem only is certainly correct -- but I'm wondering: Does it even need to have a memory effect at all? After all, it already has a divergence effect by dint of not being willreturn, so it's not legal to drop llvm.trap anyway.

So with inaccessiblemem and with read none we can loose updates on state prior to the trap, but I think those are outside of our abstract machine.
The only problem I see is a must progress function containing a trap. We could eliminate the call, couldn't we?

I think because we also have assume, the best way forward is `memory(artificial: write)` for both, or, if we want to have an easier time dropping transitive assumes:
`memory(terminate: write)` for trap, and `memory(assume: write)` for llvm.assume. Then you can drop calls to assume only functions if you would not inline them, etc.


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

https://reviews.llvm.org/D156476



More information about the llvm-commits mailing list