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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 2 14:16:19 PDT 2021


nikic 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
----------------
wecing wrote:
> 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
These are two separate things: The align attribute specifies the alignment of the load operand. The align metadata specifies the alignment of the load result (for pointer results).


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