[PATCH] D75285: Mark restrict pointer or reference to const as invariant
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 10:56:33 PST 2020
yaxunl added a comment.
In D75285#1903444 <https://reviews.llvm.org/D75285#1903444>, @rjmccall wrote:
> That is not true for two reasons: first, `restrict` guarantees that the variable is not accessed through any non-derived l-value within its scope, and that would certainly include from other threads; and second, it is undefined behavior for two threads to access the same object without synchronizing anyway (unless they're both just reading from it).
How about the cases where users cannot use restrict but they still want to mark a pointer as invariant? Or even though restrict is used but it is too complicated for alias analysis to deduce invariance?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75285/new/
https://reviews.llvm.org/D75285
More information about the cfe-commits
mailing list