jdoerfert added a comment.

In D74935#1908607 <https://reviews.llvm.org/D74935#1908607>, @jeroen.dobbelaere 
wrote:

> [...]
>  So, adding the 'noalias' attribute to %pA and %pB will change the behavior 
> of foo().
>
> hmm... this explanation is maybe getting too long ?
>  The short conclusion should be:
>
> - adding 'noalias' to a pointer argument, because it is only used to read 
> memory, might lead to 'wrong code'
> - two 'noalias' pointer arguments should not overlap or relaxed:
> - two 'noalias' pointer arguments can only overlap if they (at any level of 
> indirection) are never used to write to memory.


I think we conflate two things here:

1. The modifications to the LangRef which should be in accordance with the C 
standard (at least I haven't seen you contradict the new wording directly).
2. The extended `noalias` deduction D73428 <https://reviews.llvm.org/D73428>.

If you look at the commit message in D73428 <https://reviews.llvm.org/D73428>, 
it says that `noalias` is not just derived for all `readonly` arguments.
In your example we access `unknown` memory, e.g., `**pA=42`, so case (1) cannot 
be applied.
For case (2) we need to show that the loads of `pA` and `pB` do not alias, 
which we cannot.

WDYT?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74935



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to