yaxunl added a comment.

In D75285#1896400 <https://reviews.llvm.org/D75285#1896400>, @hfinkel wrote:

> Unfortunately, we cannot do this kind of thing just because it seems to make 
> sense. The language semantics must be exactly satisfied by the IR-level 
> semantics. I certainly agree that it would make sense for users to be able to 
> mark invariant loads, but this mechanism simply might not be the right one.
>
> One problem here is that, with something like:
>
>   char test2(X *x) {
>     const char* __restrict p = &(x->b);
>     return *p;
>   }
>   
>
> what happens when the function is inlined? Does the "invariantness" only 
> still apply to accesses within the scope of the local restrict pointer? I 
> believe that it would not, and that would be a problem because later code 
> might legally modify the relevant data.


How about inserting llvm.invariant.end at the end of scope of the variable?


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

https://reviews.llvm.org/D75285



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

Reply via email to