[PATCH] D74935: [LangRef][AliasAnalysis] Clarify `noalias` affects only modified objects

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 14:05:30 PST 2020


jdoerfert added a comment.

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

> The reason I bring this up, is that in the full restrict implementation (D68484 <https://reviews.llvm.org/D68484>), the alias analysis will do a recursive analysis, proving that *pA and *pB will never alias, because pA and pB will never alias. But this phrasing will break that assumption.


I don't understand how this will break. It will just mean in the IR below we *cannot* assume %0 and %1 are different. Given that the IR below does not represent the nested restrict it seems like this is exactly what we want. After all, we cannot determine if the IR came from your example or one with a single restrict qualifier per argument.

  ; Function Attrs: nofree norecurse nounwind uwtable
  define dso_local void @f(i32** noalias nocapture readonly %0, i32** noalias nocapture readonly %1) local_unnamed_addr #0 {
    %3 = load i32*, i32** %1, align 8, !tbaa !2
    %4 = load i32, i32* %3, align 4, !tbaa !6
    %5 = load i32*, i32** %0, align 8, !tbaa !2
    store i32 %4, i32* %5, align 4, !tbaa !6
    ret void
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74935





More information about the cfe-commits mailing list