[PATCH] D93927: [ArgPromotion] Copy !range metadata for loads.

Chenguang Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 1 10:10:33 PDT 2021


wecing marked 3 inline comments as done.
wecing added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:333-337
+              newLoad->copyMetadata(*OrigLoad, {LLVMContext::MD_nontemporal,
+                                                LLVMContext::MD_nonnull,
+                                                LLVMContext::MD_dereferenceable,
+                                                LLVMContext::MD_noundef,
+                                                LLVMContext::MD_range});
----------------
MatzeB wrote:
> How about using `llvm::copyMetadataForLoad` from `Transforms/Utils/Local.h` at a first glance it  seems to work fine even for loads in different functions.
Quoting @fhahn's comment above:

> I am not sure if it is safe to copy all metadata, it would probably be better to add them one-by-one. I was mostly asking to check which other kinds would be safe. For example, debug metadata is function specific, so it can't simply be copied I think.

`llvm::copyMetadataForLoad` also copies debug metadata, so I think it's not safe to use here. It might be better to just hand pick a few ones that are safe to copy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93927



More information about the llvm-commits mailing list