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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 03:57:42 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
----------------
lukel97 wrote:

Yeah, I think there's also several other TTI hooks like the interleaved memory op costs that we can't currently cost via the TTI printing pass. 

The printer just calls getInstructionCost + getIntrinsicInstrCost, so we could have those automatically infer the context. But I think that would have some functional changes too. Will create an issue for this.

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


More information about the llvm-commits mailing list