[PATCH] D84432: [IPSCCP] Drop argmemonly after replacing pointer argument.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 09:53:12 PDT 2020


fhahn added a comment.

In D84432#2169949 <https://reviews.llvm.org/D84432#2169949>, @jdoerfert wrote:

> This doesn't "work" for
>
>   define internal void @ptrarg.5(i64 %arg, i32 %val) argmemonly inaccessiblemem_or_argmemonly nounwind {
>     %p = inttoptr i64 %arg to i32* 
>     store i32 %val, i32* %p
>     ret void
>   }
>
>
> Unsure if that is a problem in the real world but I wanted to mention it.


Is this valid (as in not UB)? For argmemonly, langref says `... loads and stores from objects pointed to by its pointer-typed arguments, with arbitrary offsets.`, but in the example we access an object not pointed to any pointer argument.

BTW, I think it would be good to have something like an attribute verifier. Catching all violations  is impossible, but at least some things could be checked :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84432





More information about the llvm-commits mailing list