[llvm] [llubi] Vector manipulation intrinsics cleanup (PR #195004)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 00:56:46 PDT 2026


================
@@ -744,8 +746,20 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
       const auto &Vec = Args[0].asAggregate();
       const auto &SubVec = Args[1].asAggregate();
       const auto &Idx = Args[2].asInteger();
-      const uint64_t Offset = Idx.getZExtValue();
-      if (Offset + SubVec.size() > Vec.size())
+      auto EC =
+          cast<VectorType>(CB.getArgOperand(1)->getType())->getElementCount();
+      const uint64_t RawOffset = Idx.getZExtValue();
+      if (RawOffset % EC.getKnownMinValue() != 0) {
+        reportImmediateUB("llvm.vector.insert index is not a multiple of the "
+                          "subvector's known minimum vector length.");
----------------
nikic wrote:

Should just return poison, no UB.

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


More information about the llvm-commits mailing list