[PATCH] D73428: [Attributor] Improve `noalias` deduction based on memory information

Hideto Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 03:41:18 PST 2020


uenoku added a comment.

And I have a question.

  define i32 @f1(i32* %p, i32* %q){
  entry:
    %0 = load i32, i32* %q
    %1 = load i32, i32* %p
    %add = add nsw i32 %1, %0
    ret i32 %add
  }
  
  define i32 @f2(i32* nocapture readonly %p) {
  entry:
    %call = tail call i32 @f1(i32* %p, i32* %p)
    ret i32 %call
  }

In this case, `%call = tail call i32 @f1(i32* noalias %p, i32* noalias %p)` is deduced because they have only "read-read" dependencies.
I agree that this is a sound deduction since there is no write. (I know Rust compiler is doing similar things)

However, looking back to the definition of `noalias` in LangRef, I think this annotation breaks the definition.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D73428





More information about the llvm-commits mailing list