[llvm] [InstCombine] Propagate invariant.load metadata across unpacked loads (PR #152186)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 19:15:11 PDT 2025


================
@@ -718,6 +718,14 @@ static Instruction *combineLoadToOperationType(InstCombinerImpl &IC,
   return nullptr;
 }
 
+// Check if the aggregate load has a invariant.load metadata
+// If aggregate load has invariant.load metadata, add it to the
+// unpacked loads as well.
+static void copyInvariantLoadMetadata(LoadInst &LI, LoadInst *NewLoad) {
+  if (MDNode *MD = LI.getMetadata("invariant.load"))
----------------
dtcxzyw wrote:

We can use `copyMetadataForLoad`.


https://github.com/llvm/llvm-project/pull/152186


More information about the llvm-commits mailing list