[PATCH] D152798: [AMDGPU][ValueTracking] Handle amdgcn intrinsics that cannot create poison

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 06:58:18 PDT 2023


nlopes added a comment.

If a function call is guaranteed to never be inlined, then it's ok to mark the **declaration** as not returning undef/poison.
But you **can't** mark the function definition as such, since the function may in fact return a poison and then you end up with UB.

For AMD's special load intrinsics, it's fine to mark them as non-undef/poison as long as they are not lowered to vanilla load instructions in SelDag. As then the lowering would be wrong. You need to keep the façade until assembly time.

The semantics needs to be consistent throughout the pipeline. It's ok to "lie" about the semantics of something, as long as the compiler never gets to see the real thing. The real stuff can only meet at linker time. At that point there's no poison or undef values, and therefore your promises about a function/instruction not returning undef/poison are correct.

That's why you can give whatever semantics you want to **declarations**, as long as you only see the definition in assembly/SelDag and the semantics you promised correspond to the asm/SelDag thing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152798



More information about the llvm-commits mailing list