[PATCH] D150967: precommit test for memcpy removal for noalias, readonly attributed arguments

luxufan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 20 01:52:02 PDT 2023


StephenFan added inline comments.


================
Comment at: llvm/test/Transforms/MemCpyOpt/memcpy.ll:397
+; before and after the call because of its attributes.
+declare void @fnr(ptr noalias readonly)
+define noundef i32 @noalias_readonly_i8(ptr align 4 noalias readonly %val) {
----------------
For `readonly`, the LangRef says: This attribute indicates that the function does not write through this pointer argument, even though it may write to the memory that the pointer points to.
IIUC, it means there is no write that through this argument, but we can't guarantee that the memory is not written. So maybe we need to make sure the function `@fnr` has the attribute `memory(read)`? 




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

https://reviews.llvm.org/D150967



More information about the llvm-commits mailing list