[PATCH] D102348: [Instructions]: Calls marked with inaccessiblememonly attribute should be considered to not read/write memory
Ettore Tiotto via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 13 11:59:11 PDT 2021
etiotto added a comment.
> That depends on the precise semantics `@llvm.annotation` is supposed to have, with which I'm not familiar, and which LangRef does not specify particularly clearly. Is it okay to drop an `@llvm.annotation()` whose return value is not used? If "no", then marking it readonly is not possible, it will be dropped as dead code. Is it okay to hoist `@llvm.annotation()` inside an unconditional loop header out of the loop? If "no", then dropping inaccessiblememonly is not possible either (being non-speculatable would prevent hoisting out of a conditional loop header, but not an unconditional one).
Indeed. The `llvm.annotation` documents states:
This intrinsic allows annotations to be put on arbitrary expressions with arbitrary strings. This can be useful for special purpose optimizations that want to look for these annotations. These have no other defined use; they are ignored by code generation and optimization.
The sentence "they are ignored by code generation and optimization" makes me think the intrinsics should not have side-effects because if it had then it could not be ignored by optimizations.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102348/new/
https://reviews.llvm.org/D102348
More information about the llvm-commits
mailing list