[PATCH] D76792: [InlineFunction] Update metadata on loads that are return values

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 2 11:22:55 PDT 2020


anna marked an inline comment as done.
anna added a comment.

thanks for the review @jdoerfert . Will incorporate these changes and rebase on landed D76140 <https://reviews.llvm.org/D76140>.



================
Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1239
+        NewLI->setMetadata(LLVMContext::MD_nonnull, CreateMDNode(1));
+      if (uint64_t DerefBytes = AB.getDereferenceableBytes())
+        NewLI->setMetadata(LLVMContext::MD_dereferenceable,
----------------
We'll need to avoid updating dereferenceable, `dereferenceable_or_null` when these metadata is already present on the load. This will avoid updating the metadata with a different value.

In effect, we will have the same behaviour as `Attribute::merge`, where we avoid changing the attribute value when the call already has the same attribute with a value (see `test6` in D76140). Will add analogous test case here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76792





More information about the llvm-commits mailing list