[PATCH] D63067: [Attributor] NoAlias on return values.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 12 09:07:29 PDT 2019


jdoerfert added a comment.

We need more test cases, e.g. as the one below which shows some limits of the current impl.

  #include <stdlib.h>
  
  void *baz();
  void *foo(int a);
  
  void *bar()  {
    foo(0);
    return baz();
  }
  
  void *foo(int a)  {
    if (a)
      bar();
    return malloc(4);
  }



================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:716
+  if (!AARetValImpl)
+    return ChangeStatus::CHANGED;
+
----------------
You have to actually change the status to indicate a pessimistic fixpoint.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:725
+
+    /// For now, we can only deduce noalias if we have call sites.
+    /// FIXME: add more support.
----------------
You need to actually give up if RV is not a call site, so if ICS is null.


================
Comment at: llvm/test/Transforms/FunctionAttrs/noalias_returned.ll:33
+; CHECK: define i8* @call_alias()
+; CHECK-NOT: "noalias"
+define i8* @call_alias(){
----------------
No need for this check line, I think.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63067





More information about the llvm-commits mailing list