[llvm] [InstCombine] Propagate invariant.load metadata across unpacked loads (PR #152186)
    Matt Arsenault via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Aug  5 16:51:55 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"))
----------------
arsenm wrote:
Should access by MD_ enum instead of by name. Also isn't this what copyMetadataForLoad is for?
https://github.com/llvm/llvm-project/pull/152186
    
    
More information about the llvm-commits
mailing list