Should be fine for memcpy, strcpy, strncpy.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
I can't be sure whether this marking is sound.
void g(char *p); // maybe capture p void f(char *p, char *q){ g(p); memcpy(p, q, 10); }
In the case above, I think we cannot mark p as noalias in memcpy callsite. Do I misunderstand the semantic of memcpy?
Comment Actions
“ // The semantics of memcpy intrinsics forbid overlap between their respective
// operands, i.e., source and destination of any given memcpy must no-alias.”
(Alias analysis’s code comment)
Comment Actions
Tests without a constant size are missing:
strcpy(a, b)
lib/Transforms/Utils/SimplifyLibCalls.cpp | ||
---|---|---|
527 ↗ | (On Diff #214803) | See the missing test comment. |
991 ↗ | (On Diff #214803) | The size check is not necessary. If the size is 0 (statically or dynamicaly) there are no accesses, consequently "all" accesses adhere to the noalias definition. |