[PATCH] D48239: [LangRef] Clarify meaning of "dereferencable" attribute/metadata.
Nuno Lopes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 17 11:27:40 PDT 2018
nlopes added inline comments.
================
Comment at: docs/LangRef.rst:1133
+ returned value is dereferenceable for the duration of the program.
+ If the pointer cannot be dereferenced, the behavior is undefined. This
attribute may only be applied to pointer typed parameters. A pointer that
----------------
sanjoy wrote:
> DeadArgElim transforms
>
> ```
> define void @f(i8* dereferenceable(16) %ptr) {
> ret void
> }
>
> define void @caller(i8* %v) {
> call void @f(i8* %v)
> ret void
> }
> ```
>
> to
>
> ```
> define void @f(i8* dereferenceable(16) %ptr) {
> ret void
> }
>
> define void @caller(i8* %v) {
> call void @f(i8* undef)
> ret void
> }
> ```
>
> Given this semantic this transform is wrong, right?
Nice example :)
I guess DeadArgElim could be fixed to drop the dereferenceable tag?
I think being UB when the ptr is not dereferenceable sounds reasonable to me.
Repository:
rL LLVM
https://reviews.llvm.org/D48239
More information about the llvm-commits
mailing list