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

Chenguang Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 21:07:16 PDT 2021


wecing added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:316
           newLoad->setAlignment(OrigLoad->getAlign());
-          // Transfer the AA info too.
-          AAMDNodes AAInfo;
-          OrigLoad->getAAMetadata(AAInfo);
-          newLoad->setAAMetadata(AAInfo);
+          newLoad->copyMetadata(*OrigLoad, {LLVMContext::MD_align});
+          // The more aggressive assumptions made by the other metadatas may
----------------
nikic wrote:
> Why is it okay to copy align metadata unconditionally? I would have expected it to get the same treatment as other metadata.
Not an expert on this but I would expect alignments for the same type should never change? The logic has been there for 11 years: https://github.com/llvm/llvm-project/commit/81c03447fc6358197258903e3fc6ee65b16ee768


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