[PATCH] D133036: [InstCombine] Treat passing undef to noundef params as UB

Tim Neumann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 12 09:09:03 PST 2022


TimNN added a comment.

I'm still trying to properly minimize this, but this definitely interacts badly with other optimizations (which triggers the Rust CI failure I mentioned above):

- We start with two functions, `outer` and `inner`. `outer` calls `inner`. `outer` has a `noundef` argument that it forwards to `inner` (where the argument is also `noundef`).
- `PostOrderFunctionAttrsPass` decides, for both functions, that the argument is `readnone`. The `readnone` attribute is //only// added to the function definitions. The `readnone` attribute is //not// added at the `call` to `inner` from `outer`.
- The `DeadArgumentEliminationPass` decides that when `outer` calls `inner` the argument should be `poison`.
- This patch sees the `poison` being passed to a `noundef` argument and kills the call.

I don't know which component should be considered "at fault" here (or if the `readnone` bit is even relevant).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133036



More information about the cfe-commits mailing list