[llvm-branch-commits] [llvm] [SelectionDAG] Deal with POISON for INSERT_VECTOR_ELT/INSERT_SUBVECTOR (part 3) (PR #143105)

Björn Pettersson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jul 8 06:57:07 PDT 2025


================
@@ -953,8 +953,17 @@ class SelectionDAG {
   }
 
   /// Insert \p SubVec at the \p Idx element of \p Vec.
+  /// If \p SkipUndef is true and \p SubVec is UNDEF/POISON, then \p Vec is
+  /// returned.
----------------
bjope wrote:

I think having an explicit flag to say "I want an INSERT_SUBVECTOR, but you may skip if ...." is better than the implicit things going on in getNode (when you want to create a node with a specific opcode and get something else back without having explicit control).

In this wrapper it is more of a way to avoid some code duplication, by having to implement the logic for checking SubVec.isUndef() and making conditional calls to getInsertSubvector. It seemed like a good place to put that logic here.

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


More information about the llvm-branch-commits mailing list