[llvm] [VPlan] Populate and use VPIRMetadata from VPInstructions (NFC) (PR #167253)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 17 03:19:02 PST 2025


================
@@ -228,6 +234,18 @@ void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
               VPPredToIncomingValue.lookup(Pred->getExitingBasicBlock()));
       }
     } else {
+      // Build VPIRMetadata from the instruction and add loop versioning
+      // metadata for loads and stores.
+      VPIRMetadata MD(*Inst);
+      if (isa<LoadInst, StoreInst>(Inst) && LVer) {
+        const auto &[AliasScopeMD, NoAliasMD] =
+            LVer->getNoAliasMetadataFor(Inst);
+        if (AliasScopeMD)
+          MD.addMetadata(LLVMContext::MD_alias_scope, AliasScopeMD);
----------------
fhahn wrote:

Previously this needed to be handled for all memory recipe via a VPIRMetadata constructor taking LoopVersioning, e.g. the change lines 7619 in LoopVectorize. The only difference should be that now we st the metadata at a single place, whereas previously we would need to use the specific constructor at all relevant places.

```
- auto *Recipe = new VPReplicateRecipe(I, VPI->operands(), IsUniform,
-                                                                  VPIRMetadata(*Load, LVer), I->getDebugLoc());
```

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


More information about the llvm-commits mailing list