[llvm] [VPlan] Manage instruction medata in VPlan. (PR #135272)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 06:50:23 PDT 2025


================
@@ -2752,10 +2762,10 @@ void VPWidenLoadRecipe::execute(VPTransformState &State) {
     NewLI = Builder.CreateAlignedLoad(DataTy, Addr, Alignment, "wide.load");
   }
   // Add metadata to the load, but setVectorValue to the reverse shuffle.
-  State.addMetadata(NewLI, LI);
-  if (Reverse)
-    NewLI = Builder.CreateVectorReverse(NewLI, "reverse");
-  State.set(this, NewLI);
+  State.addNewMetadata(NewLI, LI);
+  applyMetadata(*NewLI);
+  State.set(this,
+            Reverse ? Builder.CreateVectorReverse(NewLI, "reverse") : NewLI);
----------------
ayalz wrote:

This change is to avoid casting the vector reverse of NewLI to Instruction:
```
  if (Reverse)
    NewLI = cast<Instruction>(Builder.CreateVectorReverse(NewLI, "reverse"));
  State.set(this, NewLI);
```
?

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


More information about the llvm-commits mailing list