[PATCH] D99135: [deref] Implement initial set of inference rules for deref-at-point

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 23 04:19:21 PDT 2021


nlopes requested changes to this revision.
nlopes added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/IR/Value.cpp:741
+  // *) An alloca is deallocated when the function returns
+  if (isa<GlobalValue>(V) || isa<Constant>(V) || isa<AllocaInst>(V))
+    return false;
----------------
an Alloca can be killed with the lifetime intrinsics. Storing to an alloca after lifetime_end is UB.


================
Comment at: llvm/lib/IR/Value.cpp:756
+    // on F's behalf either.
+    if (A->hasNoFreeAttr() && A->hasNoAliasAttr())
+      return false;
----------------
I don't understand this argument of why hasNoSync isn't needed.
All argument attributes are with respect to what the function does, not the environment. It would be impossible to infer attributes if the environment was considered.

My understanding is that readonly implies nofree. Can't see why nofree would have those special semantics


================
Comment at: llvm/lib/IR/Value.cpp:769
+      return false;
+  }
+
----------------
FWIW missing byval case (can't be freed).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99135



More information about the llvm-commits mailing list