[llvm] [RISCV][VPlan] Cost vp.merges that are likely to be folded away as free (PR #209387)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 02:14:32 PDT 2026


================
@@ -175,6 +175,24 @@ class MemIntrinsicCostAttributes {
   Align getAlignment() const { return Alignment; }
 };
 
+/// Represents a hint about the context in which a vector instruction or
+/// intrinsic is used.
+///
+/// On some targets, inserts/extracts can cheaply be folded into loads/stores.
+/// Similarly, vp.merge can also be folded into binary ops on some targets.
+///
+/// This enum allows the vectorizer to give getVectorInstrCost and
+/// getIntrinsicInstrCost an idea of how the values are used.
+///
+/// See \c getVectorInstrContextHint to compute a VectorInstrContext from an
----------------
fhahn wrote:

It would be good if we could test this via cost model tests. Could we pass through the context in the TTI printing pass (perhaps automatically when a context instruction is passed?)

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


More information about the llvm-commits mailing list